summaryrefslogtreecommitdiff
path: root/t/helper/test-run-command.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2018-01-18 09:45:11 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-01-19 18:49:20 (GMT)
commitc61a975df1d3d5e448622f951e6dd584ee21ebf3 (patch)
tree375821474938a1f288c2c40e07b49ed0590ea7cc /t/helper/test-run-command.c
parent21dfc5e08fec74ded0ab4206bca0927a38feb882 (diff)
downloadgit-c61a975df1d3d5e448622f951e6dd584ee21ebf3.zip
git-c61a975df1d3d5e448622f951e6dd584ee21ebf3.tar.gz
git-c61a975df1d3d5e448622f951e6dd584ee21ebf3.tar.bz2
run-command.c: print env vars in trace_run_command()
Occasionally submodule code could execute new commands with GIT_DIR set to some submodule. GIT_TRACE prints just the command line which makes it hard to tell that it's not really executed on this repository. Print the env delta (compared to parent environment) in this case. Helped-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/helper/test-run-command.c')
-rw-r--r--t/helper/test-run-command.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/t/helper/test-run-command.c b/t/helper/test-run-command.c
index d24d157..153342e 100644
--- a/t/helper/test-run-command.c
+++ b/t/helper/test-run-command.c
@@ -56,6 +56,15 @@ int cmd_main(int argc, const char **argv)
if (argc < 3)
return 1;
+ while (!strcmp(argv[1], "env")) {
+ if (!argv[2])
+ die("env specifier without a value");
+ argv_array_push(&proc.env_array, argv[2]);
+ argv += 2;
+ argc -= 2;
+ }
+ if (argc < 3)
+ return 1;
proc.argv = (const char **)argv + 2;
if (!strcmp(argv[1], "start-command-ENOENT")) {