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>
Jeff King committed
Sep 21, 2012 at 01:32 UTC
59bfdfb82a0e51f6e0a40197cd662196406b1bec
1 file changed
+6
-1
builtin/receive-pack.c
+6
-1
@@ -821,6 +821,7 @@ static const char *unpack(void)
821
822
if (ntohl(hdr.hdr_entries) < unpack_limit) {
823
int code, i = 0;
824
+ struct child_process child;
825
const char *unpacker[5];
826
unpacker[i++] = "unpack-objects";
827
if (quiet)
@@ -829,7 +830,11 @@ static const char *unpack(void)
830
unpacker[i++] = "--strict";
831
unpacker[i++] = hdr_arg;
832
unpacker[i++] = NULL;
832
- code = run_command_v_opt(unpacker, RUN_GIT_CMD);
833
+ memset(&child, 0, sizeof(child));
834
+ child.argv = unpacker;
835
+ child.no_stdout = 1;
836
+ child.git_cmd = 1;
837
+ code = run_command(&child);
838
if (!code)
839
return NULL;
840
return "unpack-objects abnormal exit";