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(NULL
, 0, format
, params
);
46 buffer
= xmalloc(length
+ 1);
47 vsnprintf(buffer
, length
+ 1, format
, params
);
49 fwrite(buffer
, sizeof(char), length
, debug_git_fp
);
50 fputc('\n', debug_git_fp
);
56 void _debug_git_mbox(char *format
, ...)
61 va_start(params
, format
);
62 vsnprintf(buffer
, sizeof(buffer
), format
, params
);