@matheusbsbs / matheus-bagliano / commits / 7e2342d098
Fork 0

trace: give repo_setup trace its own key

You no longer get this output with GIT_TRACE=1; instead, you can do GIT_TRACE_SETUP=1. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Feb 24, 2011 at 09:30 UTC 7e2342d0987f7f78bc8582e97bbfbafd80d327ef
2 files changed +7 -6
t/t1510-repo-setup.sh
+1 -1
@@ -57,7 +57,7 @@ test_repo () {
57 export GIT_WORK_TREE
58 fi &&
59 rm -f trace &&
60 - GIT_TRACE="$(pwd)/trace" git symbolic-ref HEAD >/dev/null &&
60 + GIT_TRACE_SETUP="$(pwd)/trace" git symbolic-ref HEAD >/dev/null &&
61 grep '^setup: ' trace >result &&
62 test_cmp expected result
63 )
trace.c
+6 -5
@@ -155,10 +155,11 @@ static const char *quote_crnl(const char *path)
155 /* FIXME: move prefix to startup_info struct and get rid of this arg */
156 void trace_repo_setup(const char *prefix)
157 {
158 + static const char *key = "GIT_TRACE_SETUP";
159 const char *git_work_tree;
160 char cwd[PATH_MAX];
161
161 - if (!trace_want("GIT_TRACE"))
162 + if (!trace_want(key))
163 return;
164
165 if (!getcwd(cwd, PATH_MAX))
@@ -170,10 +171,10 @@ void trace_repo_setup(const char *prefix)
171 if (!prefix)
172 prefix = "(null)";
173
173 - trace_printf("setup: git_dir: %s\n", quote_crnl(get_git_dir()));
174 - trace_printf("setup: worktree: %s\n", quote_crnl(git_work_tree));
175 - trace_printf("setup: cwd: %s\n", quote_crnl(cwd));
176 - trace_printf("setup: prefix: %s\n", quote_crnl(prefix));
174 + trace_printf_key(key, "setup: git_dir: %s\n", quote_crnl(get_git_dir()));
175 + trace_printf_key(key, "setup: worktree: %s\n", quote_crnl(git_work_tree));
176 + trace_printf_key(key, "setup: cwd: %s\n", quote_crnl(cwd));
177 + trace_printf_key(key, "setup: prefix: %s\n", quote_crnl(prefix));
178 }
179
180 int trace_want(const char *key)