Skip to content

Commit cb50761

Browse files
pcloudsgitster
authored andcommitted
trace.c: export trace_setup_key
This is so that we can print traces based on this key outside trace.c. Signed-off-by: Nguyễn Thái Ngọc Duy <[email protected]> Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 48988c4 commit cb50761

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

trace.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
struct trace_key trace_default_key = { "GIT_TRACE", 0, 0, 0 };
2828
struct trace_key trace_perf_key = TRACE_KEY_INIT(PERFORMANCE);
29+
struct trace_key trace_setup_key = TRACE_KEY_INIT(SETUP);
2930

3031
/* Get a trace file descriptor from "key" env variable. */
3132
static int get_trace_fd(struct trace_key *key)
@@ -300,11 +301,10 @@ static const char *quote_crnl(const char *path)
300301
/* FIXME: move prefix to startup_info struct and get rid of this arg */
301302
void trace_repo_setup(const char *prefix)
302303
{
303-
static struct trace_key key = TRACE_KEY_INIT(SETUP);
304304
const char *git_work_tree;
305305
char *cwd;
306306

307-
if (!trace_want(&key))
307+
if (!trace_want(&trace_setup_key))
308308
return;
309309

310310
cwd = xgetcwd();
@@ -315,11 +315,11 @@ void trace_repo_setup(const char *prefix)
315315
if (!prefix)
316316
prefix = "(null)";
317317

318-
trace_printf_key(&key, "setup: git_dir: %s\n", quote_crnl(get_git_dir()));
319-
trace_printf_key(&key, "setup: git_common_dir: %s\n", quote_crnl(get_git_common_dir()));
320-
trace_printf_key(&key, "setup: worktree: %s\n", quote_crnl(git_work_tree));
321-
trace_printf_key(&key, "setup: cwd: %s\n", quote_crnl(cwd));
322-
trace_printf_key(&key, "setup: prefix: %s\n", quote_crnl(prefix));
318+
trace_printf_key(&trace_setup_key, "setup: git_dir: %s\n", quote_crnl(get_git_dir()));
319+
trace_printf_key(&trace_setup_key, "setup: git_common_dir: %s\n", quote_crnl(get_git_common_dir()));
320+
trace_printf_key(&trace_setup_key, "setup: worktree: %s\n", quote_crnl(git_work_tree));
321+
trace_printf_key(&trace_setup_key, "setup: cwd: %s\n", quote_crnl(cwd));
322+
trace_printf_key(&trace_setup_key, "setup: prefix: %s\n", quote_crnl(prefix));
323323

324324
free(cwd);
325325
}

trace.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ extern struct trace_key trace_default_key;
1515

1616
#define TRACE_KEY_INIT(name) { "GIT_TRACE_" #name, 0, 0, 0 }
1717
extern struct trace_key trace_perf_key;
18+
extern struct trace_key trace_setup_key;
1819

1920
extern void trace_repo_setup(const char *prefix);
2021
extern int trace_want(struct trace_key *key);

0 commit comments

Comments
 (0)