Skip to content

Commit

Permalink
trace: give repo_setup trace its own key
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jeff King authored and Junio C Hamano committed Mar 8, 2011
1 parent bbc30f9 commit 7e2342d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion t/t1510-repo-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down
11 changes: 6 additions & 5 deletions trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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)
Expand Down

0 comments on commit 7e2342d

Please sign in to comment.