From: Junio C Hamano Date: Tue, 7 Aug 2012 05:31:10 +0000 (-0700) Subject: receive-pack: do not leak output from auto-gc to standard output X-Git-Tag: v1.7.11.6~19^2 X-Git-Url: http://git.tremily.us/?p=git.git;a=commitdiff_plain;h=4b7f2fa4c6c2c4675ab00474d419fa356afdfa71 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 --- diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c index 0afb8b289..3f05d971e 100644 --- a/builtin/receive-pack.c +++ b/builtin/receive-pack.c @@ -977,7 +977,8 @@ int cmd_receive_pack(int argc, const char **argv, const char *prefix) const char *argv_gc_auto[] = { "gc", "--auto", "--quiet", NULL, }; - run_command_v_opt(argv_gc_auto, RUN_GIT_CMD); + int opt = RUN_GIT_CMD | RUN_COMMAND_STDOUT_TO_STDERR; + run_command_v_opt(argv_gc_auto, opt); } if (auto_update_server_info) update_server_info(0); diff --git a/t/t5400-send-pack.sh b/t/t5400-send-pack.sh index 04a87913e..250c720c1 100755 --- a/t/t5400-send-pack.sh +++ b/t/t5400-send-pack.sh @@ -145,7 +145,7 @@ test_expect_success 'push --all excludes remote-tracking hierarchy' ' ) ' -test_expect_failure 'receive-pack runs auto-gc in remote repo' ' +test_expect_success 'receive-pack runs auto-gc in remote repo' ' rm -rf parent child && git init parent && (