diff options
author | Lukas Fleischer <lfleischer@lfos.de> | 2016-06-28 06:35:26 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-07-01 13:09:37 -0700 |
commit | 5e5be9e257239b3599701f05518ce9e45f565e9f (patch) | |
tree | 0043651653e62cd21bd1b3c9b6a6e6e17f38b29f /Documentation/git-submodule.txt | |
parent | Git 2.4.11 (diff) | |
download | tgif-5e5be9e257239b3599701f05518ce9e45f565e9f.tar.xz |
sideband.c: refactor recv_sideband()
We used character buffer manipulations to split messages from the
sideband at line breaks and insert "remote: " at the beginning of
each line, using the packet size to determine the end of a message.
However, since it is safe to assume that diagnostic messages from
the sideband never contain NUL characters, we can also NUL-terminate
the buffer, use strpbrk() for splitting lines and use format strings
to insert the prefix, to make the code easier to read and maintain.
A strbuf is used for accumulating the output which is then printed
using a single write(2) call to ensure the atomicity of the output.
See 9ac13ec (atomic write for sideband remote messages, 2006-10-11)
for details.
Helped-by: Jeff King <peff@peff.net>
Helped-by: Junio C Hamano <gitster@pobox.com>
Helped-by: Nicolas Pitre <nico@fluxnic.net>
Signed-off-by: Lukas Fleischer <lfleischer@lfos.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation/git-submodule.txt')
0 files changed, 0 insertions, 0 deletions