diff options
author | Jonathan Tan <jonathantanmy@google.com> | 2019-01-16 20:28:14 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-01-17 20:25:07 +0100 |
commit | 0bbc0bc5745ab8b294a5faf8c3b1d939ae8b6d10 (patch) | |
tree | 09c885895d97cd7c5d1243035ca281be098123ab /sideband.c | |
parent | sideband: reverse its dependency on pkt-line (diff) | |
download | git-0bbc0bc5745ab8b294a5faf8c3b1d939ae8b6d10.tar.xz git-0bbc0bc5745ab8b294a5faf8c3b1d939ae8b6d10.zip |
{fetch,upload}-pack: sideband v2 fetch response
Currently, a response to a fetch request has sideband support only while
the packfile is being sent, meaning that the server cannot send notices
until the start of the packfile.
Extend sideband support in protocol v2 fetch responses to the whole
response. upload-pack will advertise it if the
uploadpack.allowsidebandall configuration variable is set, and
fetch-pack will automatically request it if advertised.
If the sideband is to be used throughout the whole response, upload-pack
will use it to send errors instead of prefixing a PKT-LINE payload with
"ERR ".
This will be tested in a subsequent patch.
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sideband.c')
-rw-r--r-- | sideband.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sideband.c b/sideband.c index e89d677626..6a16feb262 100644 --- a/sideband.c +++ b/sideband.c @@ -114,6 +114,7 @@ static void maybe_colorize_sideband(struct strbuf *dest, const char *src, int n) #define DUMB_SUFFIX " " int demultiplex_sideband(const char *me, char *buf, int len, + int die_on_error, struct strbuf *scratch, enum sideband_type *sideband_type) { @@ -144,6 +145,8 @@ int demultiplex_sideband(const char *me, char *buf, int len, len--; switch (band) { case 3: + if (die_on_error) + die("remote error: %s", buf + 1); strbuf_addf(scratch, "%s%s", scratch->len ? "\n" : "", DISPLAY_PREFIX); maybe_colorize_sideband(scratch, buf + 1, len); @@ -195,6 +198,8 @@ int demultiplex_sideband(const char *me, char *buf, int len, } cleanup: + if (die_on_error && *sideband_type == SIDEBAND_PROTOCOL_ERROR) + die("%s", scratch->buf); if (scratch->len) { strbuf_addch(scratch, '\n'); xwrite(2, scratch->buf, scratch->len); |