summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Nguyễn Thái Ngọc Duy <pclouds@gmail.com>2018-01-18 16:45:10 +0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2018-01-19 10:49:20 -0800
commit21dfc5e08fec74ded0ab4206bca0927a38feb882 (patch)
treeacf1bc2fc5359dd106a6bddc27488205ea303f41
parentrun-command.c: introduce trace_run_command() (diff)
downloadtgif-21dfc5e08fec74ded0ab4206bca0927a38feb882.tar.xz
run-command.c: print program 'git' when tracing git_cmd mode
We normally print full command line, including the program and its argument. When git_cmd is set, we have a special code path to run the right "git" program and child_process.argv[0] will not contain the program name anymore. As a result, we print just the command arguments. I thought it was a regression when the code was refactored and git_cmd added, but apparently it's not. git_cmd mode was introduced before tracing was added in 8852f5d704 (run_command(): respect GIT_TRACE - 2008-07-07) so it's more like an oversight in 8852f5d704. Fix it, print the program name "git" in git_cmd mode. It's nice to have now. But it will be more important later when we start to print env variables too, in shell syntax. The lack of a program name would look confusing then. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--run-command.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/run-command.c b/run-command.c
index eadba8cb0d..326c33e3cd 100644
--- a/run-command.c
+++ b/run-command.c
@@ -565,6 +565,8 @@ static void trace_run_command(const struct child_process *cp)
return;
strbuf_addf(&buf, "trace: run_command:");
+ if (cp->git_cmd)
+ strbuf_addstr(&buf, " git");
sq_quote_argv_pretty(&buf, cp->argv);
trace_printf("%s", buf.buf);