aboutsummaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2012-09-21 01:32:52 -0400
committerJunio C Hamano <gitster@pobox.com>2012-09-21 09:44:11 -0700
commit59bfdfb82a0e51f6e0a40197cd662196406b1bec (patch)
treeba83e6a84c5bb50ca03f3506fcff685216c91125 /builtin
parent8ef2794ba8ada6b64afb22ff7b235dce583b9712 (diff)
downloadgit-59bfdfb82a0e51f6e0a40197cd662196406b1bec.tar.gz
git-59bfdfb82a0e51f6e0a40197cd662196406b1bec.tar.xz
receive-pack: redirect unpack-objects stdout to /dev/null
The unpack-objects command should not generally produce any output on stdout. However, if it's given extra input after the packfile, it will spew the remainder to stdout. When called by receive-pack, this means we will break protocol, since our stdout is connected to the remote send-pack. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/receive-pack.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index 2cb854feb..f8d2f1710 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -821,6 +821,7 @@ static const char *unpack(void)
if (ntohl(hdr.hdr_entries) < unpack_limit) {
int code, i = 0;
+ struct child_process child;
const char *unpacker[5];
unpacker[i++] = "unpack-objects";
if (quiet)
@@ -829,7 +830,11 @@ static const char *unpack(void)
unpacker[i++] = "--strict";
unpacker[i++] = hdr_arg;
unpacker[i++] = NULL;
- code = run_command_v_opt(unpacker, RUN_GIT_CMD);
+ memset(&child, 0, sizeof(child));
+ child.argv = unpacker;
+ child.no_stdout = 1;
+ child.git_cmd = 1;
+ code = run_command(&child);
if (!code)
return NULL;
return "unpack-objects abnormal exit";