1 #include "git-compat-util.h"
2 #include "systeminfo.h"
5 static FILE *debug_git_fp
= NULL
;
8 static void reset_inherit_flag(FILE *file
)
15 handle
= (HANDLE
)_get_osfhandle(_fileno(file
));
16 SetHandleInformation(handle
, HANDLE_FLAG_INHERIT
, 0);
20 void debug_git(char * format
, ...)
25 GetTempPathW(MAX_PATH
, path
);
26 wcsncat(path
, L
"git_shell_ext_debug.txt", MAX_PATH
);
27 debug_git_fp
= _wfopen(path
, L
"a+");
28 reset_inherit_flag(debug_git_fp
);
30 debug_git_fp
= fopen("/tmp/git-cheetah-plugin.log", "a+");
34 /* Check again in case the above debug_git_set_file failed. */
41 va_start(params
, format
);
42 length
= vsnprintf(buffer
, sizeof(buffer
), format
, params
);
44 fwrite(buffer
, sizeof(char), length
, debug_git_fp
);
45 fputc('\n', debug_git_fp
);
50 void debug_git_mbox(char *format
, ...)
55 va_start(params
, format
);
56 vsnprintf(buffer
, sizeof(buffer
), format
, params
);