Skip to content

Commit 21dfc5e

Browse files
pcloudsgitster
authored andcommitted
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 8852f5d (run_command(): respect GIT_TRACE - 2008-07-07) so it's more like an oversight in 8852f5d. 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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e73dd78 commit 21dfc5e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

run-command.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,8 @@ static void trace_run_command(const struct child_process *cp)
565565
return;
566566

567567
strbuf_addf(&buf, "trace: run_command:");
568+
if (cp->git_cmd)
569+
strbuf_addstr(&buf, " git");
568570
sq_quote_argv_pretty(&buf, cp->argv);
569571

570572
trace_printf("%s", buf.buf);

0 commit comments

Comments
 (0)