receive-pack: do not leak output from auto-gc to standard output
The standard output channel of receive-pack is a structured protocol channel, and subprocesses must never be allowed to leak anything into it by writing to their standard output. Use RUN_COMMAND_STDOUT_TO_STDERR option to run_command_v_opt() just like we do when running hooks to prevent output from "gc" leaking to the standard output. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Aug 6, 2012 at 22:31 UTC
4b7f2fa4c6c2c4675ab00474d419fa356afdfa71
2 files changed
+3
-2
builtin/receive-pack.c
+2
-1
@@ -977,7 +977,8 @@ int cmd_receive_pack(int argc, const char **argv, const char *prefix)
977
const char *argv_gc_auto[] = {
978
"gc", "--auto", "--quiet", NULL,
979
};
980
- run_command_v_opt(argv_gc_auto, RUN_GIT_CMD);
980
+ int opt = RUN_GIT_CMD | RUN_COMMAND_STDOUT_TO_STDERR;
981
+ run_command_v_opt(argv_gc_auto, opt);
982
}
983
if (auto_update_server_info)
984
update_server_info(0);
t/t5400-send-pack.sh
+1
-1
@@ -145,7 +145,7 @@ test_expect_success 'push --all excludes remote-tracking hierarchy' '
145
)
146
'
147
148
-test_expect_failure 'receive-pack runs auto-gc in remote repo' '
148
+test_expect_success 'receive-pack runs auto-gc in remote repo' '
149
rm -rf parent child &&
150
git init parent &&
151
(