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:
Johannes Schindelin
2007-08-04 15:28:24 +01:00
parent 0e2bdc35af
commit ef5af72062
2 changed files with 5 additions and 1 deletions

View File

@@ -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 *);

View File

@@ -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,