summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2011-02-24 09:30:30 -0500
committerJunio C Hamano <gitster@pobox.com>2011-03-08 12:12:04 -0800
commit7e2342d0987f7f78bc8582e97bbfbafd80d327ef (patch)
tree06e7af5004f763ee8b64879d83d5dc1e514fb24f
parentbbc30f996380eacd71ca061675d5d0c5f21c45d2 (diff)
downloadgit-7e2342d0987f7f78bc8582e97bbfbafd80d327ef.tar.gz
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>
-rwxr-xr-xt/t1510-repo-setup.sh2
-rw-r--r--trace.c11
2 files changed, 7 insertions, 6 deletions
diff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh
index 15101d5e03..ec50a9ad70 100755
--- a/t/t1510-repo-setup.sh
+++ b/t/t1510-repo-setup.sh
@@ -57,7 +57,7 @@ test_repo () {
export GIT_WORK_TREE
fi &&
rm -f trace &&
- GIT_TRACE="$(pwd)/trace" git symbolic-ref HEAD >/dev/null &&
+ GIT_TRACE_SETUP="$(pwd)/trace" git symbolic-ref HEAD >/dev/null &&
grep '^setup: ' trace >result &&
test_cmp expected result
)
diff --git a/trace.c b/trace.c
index 9f39eab025..8390bf7cbb 100644
--- a/trace.c
+++ b/trace.c
@@ -155,10 +155,11 @@ static const char *quote_crnl(const char *path)
/* FIXME: move prefix to startup_info struct and get rid of this arg */
void trace_repo_setup(const char *prefix)
{
+ static const char *key = "GIT_TRACE_SETUP";
const char *git_work_tree;
char cwd[PATH_MAX];
- if (!trace_want("GIT_TRACE"))
+ if (!trace_want(key))
return;
if (!getcwd(cwd, PATH_MAX))
@@ -170,10 +171,10 @@ void trace_repo_setup(const char *prefix)
if (!prefix)
prefix = "(null)";
- trace_printf("setup: git_dir: %s\n", quote_crnl(get_git_dir()));
- trace_printf("setup: worktree: %s\n", quote_crnl(git_work_tree));
- trace_printf("setup: cwd: %s\n", quote_crnl(cwd));
- trace_printf("setup: prefix: %s\n", quote_crnl(prefix));
+ trace_printf_key(key, "setup: git_dir: %s\n", quote_crnl(get_git_dir()));
+ trace_printf_key(key, "setup: worktree: %s\n", quote_crnl(git_work_tree));
+ trace_printf_key(key, "setup: cwd: %s\n", quote_crnl(cwd));
+ trace_printf_key(key, "setup: prefix: %s\n", quote_crnl(prefix));
}
int trace_want(const char *key)