Skip to content

Commit

Permalink
receive-pack: do not leak output from auto-gc to standard output
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Junio C Hamano committed Aug 7, 2012
1 parent 2c3fd4b commit 4b7f2fa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion builtin/receive-pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion t/t5400-send-pack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
(
Expand Down

0 comments on commit 4b7f2fa

Please sign in to comment.