mirror of
https://github.com/git/git.git
synced 2026-03-13 18:33:25 +01:00
Minimal changes to allow for GIT_TRACE=/trace.txt (is_absolute_path())
This imitates what is currently in git.git's master: a function to determine if a path is absolute. msysgit.git is not really the proper place to fix this, but Hannes is still on holiday. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
4
cache.h
4
cache.h
@@ -359,6 +359,10 @@ int git_config_perm(const char *var, const char *value);
|
||||
int adjust_shared_perm(const char *path);
|
||||
int safe_create_leading_directories(char *path);
|
||||
char *enter_repo(char *path, int strict);
|
||||
static inline int is_absolute_path(const char *path)
|
||||
{
|
||||
return path[0] == '/' || (isalpha(path[0]) && path[1] == ':');
|
||||
}
|
||||
|
||||
/* Read and unpack a sha1 file into memory, write memory to a sha1 file */
|
||||
extern int sha1_object_info(const unsigned char *, unsigned long *);
|
||||
|
||||
2
trace.c
2
trace.c
@@ -64,7 +64,7 @@ static int get_trace_fd(int *need_close)
|
||||
return STDERR_FILENO;
|
||||
if (strlen(trace) == 1 && isdigit(*trace))
|
||||
return atoi(trace);
|
||||
if (*trace == '/') {
|
||||
if (is_absolute_path(trace)) {
|
||||
int fd = open(trace, O_WRONLY | O_APPEND | O_CREAT, 0666);
|
||||
if (fd == -1) {
|
||||
fprintf(stderr,
|
||||
|
||||
Reference in New Issue
Block a user