diff options
author | Jeff King <peff@peff.net> | 2016-07-15 06:36:14 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-07-20 12:11:10 -0700 |
commit | d415092ac4a7fb474dc9823a1cc08ae824267e35 (patch) | |
tree | 80c748460c61d64c2372e60d8aff4d80b3e35c50 /builtin | |
parent | d06303bb9a6c3791ff67078b480a86cfd9b691ea (diff) | |
download | git-d415092ac4a7fb474dc9823a1cc08ae824267e35.tar.gz git-d415092ac4a7fb474dc9823a1cc08ae824267e35.tar.xz |
receive-pack: relay connectivity errors to sideband
If the connectivity check encounters a problem when
receiving a push, the error output goes to receive-pack's
stderr, whose destination depends on the protocol used
(ssh tends to send it to the user, though without a "remote"
prefix; http will generally eat it in the server's error
log).
The information should consistently go back to the user, as
there is a reasonable chance their client is buggy and
generating a bad pack.
We can do so by muxing it over the sideband as we do with
other sub-process stderr.
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.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c index de322bc49..d309109ab 100644 --- a/builtin/receive-pack.c +++ b/builtin/receive-pack.c @@ -1317,9 +1317,12 @@ static void execute_commands(struct command *commands, const char *unpacker_error, struct shallow_info *si) { + struct check_connected_options opt = CHECK_CONNECTED_INIT; struct command *cmd; unsigned char sha1[20]; struct iterate_data data; + struct async muxer; + int err_fd = 0; if (unpacker_error) { for (cmd = commands; cmd; cmd = cmd->next) @@ -1327,11 +1330,24 @@ static void execute_commands(struct command *commands, return; } + if (use_sideband) { + memset(&muxer, 0, sizeof(muxer)); + muxer.proc = copy_to_sideband; + muxer.in = -1; + if (!start_async(&muxer)) + err_fd = muxer.in; + /* ...else, continue without relaying sideband */ + } + data.cmds = commands; data.si = si; - if (check_connected(iterate_receive_command_list, &data, NULL)) + opt.err_fd = err_fd; + if (check_connected(iterate_receive_command_list, &data, &opt)) set_connectivity_errors(commands, si); + if (use_sideband) + finish_async(&muxer); + reject_updates_to_hidden(commands); if (run_receive_hook(commands, "pre-receive", 0)) { |