Skip to content

run-command.c: print env vars when GIT_TRACE is set

Nguyễn Thái Ngọc Duy git 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest4 patches 20 repliesIn review
  2. v21 patch 5 repliesSuperseded
  3. v11 patch 7 repliesSuperseded

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4trace.c: introduce trace_run_command()run-command.c trace.c trace.h+20 -12 replies
2/4trace.c: print program 'git' when child_process.git_cmd is settrace.c+3 -01 reply
3/4trace.c: print env vars in trace_run_command()trace.c+27 -01 reply
4/4trace.c: be smart about what env to print in trace_run_command()trace.c+69 -89 replies

Reviews trailers per patch

None of the 4 patches has a Reviewed-by or Acked-by.

PatchJunio C Hamano
SeriesHelped-by Helped-by Helped-by
1/4
2/4
3/4
4/4

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH v3 0/4] run-command.c: print env vars when GIT_TRACE is set

v3 turns a single patch into a series. Changes from v2

- env var quoting is now done correctly (from shell syntax perspective)
- the program name is prepended in git_cmd mode
- cwd is now printed too (because I have too, see 4/4)
- we don't blindly print the env delta anymore but print the actual differences compared to parent env
- which means we also print "unset XXX" statements in $GIT_TRACE

The new output on git.git looks like this

trace: run_command: cd 'sha1collisiondetection'; unset GIT_PREFIX; GIT_DIR='.git' git 'status' '--porcelain=2'

a bit longer than I would like, but that's because of sha1collisiondetection and it's not long enough for me to invent $GIT_TRACE_EXEC.

I'm not adding "sh -c" back though because that looks like it should be done in run_command.c itself, not just output tracing output.

Oh.. before anybody asks, I'm not adding git prefix to the "cd" part. You're supposed to know that git moves back to worktree top dir when you read $GIT_TRACE (or are welcome to improve the print out).

Nguyễn Thái Ngọc Duy (4):
trace.c: introduce trace_run_command()
trace.c: print program 'git' when child_process.git_cmd is set trace.c: print env vars in trace_run_command() trace.c: be smart about what env to print in trace_run_command()

 run-command.c |   3 +-
 trace.c       | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 trace.h       |   3 ++
 3 files changed, 111 insertions(+), 1 deletion(-)
Signature · 1 line
2.15.1.600.g899a5f85c6