提交 59bfdfb8 编写于 作者: J Jeff King 提交者: Junio C Hamano

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: NJeff King <peff@peff.net>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 8ef2794b
......@@ -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";
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册