1 #include "git-compat-util.h"
4 static char debug_git_file
[MAX_PATH
];
5 static FILE * debug_git_fd
= NULL
;
7 void debug_git_set_file(const char * filename
)
15 strncpy(debug_git_file
, filename
, MAX_PATH
);
16 debug_git_file
[MAX_PATH
-1] = '\0';
18 debug_git_fd
= fopen(debug_git_file
, "a+");
21 void debug_git(char * format
, ...)
25 debug_git_set_file(DEFAULT_DEBUG_GIT_FILE
);
28 /* Check again in case the above debug_git_set_file failed. */
35 va_start(params
, format
);
36 length
= vsnprintf(buffer
, sizeof(buffer
), format
, params
);
38 fwrite(buffer
, sizeof(char), length
, debug_git_fd
);
39 fputc('\n', debug_git_fd
);
44 void debug_git_mbox(char *format
, ...)
49 va_start(params
, format
);
50 vsnprintf(buffer
, sizeof(buffer
), format
, params
);