If a command sets a new env variable GIT_DIR=.git, we need more context to know where that '.git' is related to. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> --- trace.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/trace.c b/trace.c index ffa1cf9b91..4bfd3fce10 100644 --- a/trace.c +++ b/trace.c @@ -342,6 +342,12 @@ void trace_run_command(const struct child_process *cp) strbuf_addf(&buf, "trace: run_command:"); + if (cp->dir) { + strbuf_addstr(&buf, " cd "); + sq_quote_buf_pretty(&buf, cp->dir); + strbuf_addch(&buf, ';'); + } + /* * The caller is responsible for initializing cp->env from * cp->env_array if needed. We only check one place. -- 2.15.1.600.g899a5f85c6