Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2020-10-19 22:35:41 +0300
committerJunio C Hamano <gitster@pobox.com>2020-10-20 23:31:02 +0300
commit8e86cf6581655624e1f3284126c5ea664685eb44 (patch)
tree0b0d50aa9a7f0354be6f67278a87fe560c518296 /pkt-line.c
parent17e7dbbcbcee6912b00c815f4e800a3d38cd767c (diff)
sideband: report unhandled incomplete sideband messages as bugs
It was pretty tricky to verify that incomplete sideband messages are handled correctly by the `recv_sideband()`/`demultiplex_sideband()` code: they have to be flushed out at the end of the loop in `recv_sideband()`, but the actual flushing is done by the `demultiplex_sideband()` function (which therefore has to know somehow that the loop will be done after it returns). To catch future bugs where incomplete sideband messages might not be shown by mistake, let's catch that condition and report a bug. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'pkt-line.c')
-rw-r--r--pkt-line.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/pkt-line.c b/pkt-line.c
index 844c253ccd..657a702927 100644
--- a/pkt-line.c
+++ b/pkt-line.c
@@ -471,6 +471,9 @@ int recv_sideband(const char *me, int in_stream, int out)
write_or_die(out, buf + 1, len - 1);
break;
default: /* errors: message already written */
+ if (scratch.len > 0)
+ BUG("unhandled incomplete sideband: '%s'",
+ scratch.buf);
return sideband_type;
}
}