Skip to content

Commit 8e86cf6

Browse files
dschogitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 17e7dbb commit 8e86cf6

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pkt-line.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,9 @@ int recv_sideband(const char *me, int in_stream, int out)
471471
write_or_die(out, buf + 1, len - 1);
472472
break;
473473
default: /* errors: message already written */
474+
if (scratch.len > 0)
475+
BUG("unhandled incomplete sideband: '%s'",
476+
scratch.buf);
474477
return sideband_type;
475478
}
476479
}

0 commit comments

Comments
 (0)