diff options
author | Thomas Rast <trast@student.ethz.ch> | 2012-02-22 20:34:23 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-02-23 09:36:44 -0800 |
commit | bc2fed496baa54ae99dede7da23dec938adbf0eb (patch) | |
tree | 341eb95a881f015853e003bcfad2ce9326686961 /Documentation/RelNotes/1.7.7.6.txt | |
parent | bundle: put strbuf_readline_fd in strbuf.c with adjustments (diff) | |
download | tgif-bc2fed496baa54ae99dede7da23dec938adbf0eb.tar.xz |
bundle: use a strbuf to scan the log for boundary commits
The first part of the bundle header contains the boundary commits, and
could be approximated by
# v2 git bundle
$(git rev-list --pretty=oneline --boundary <ARGS> | grep ^-)
git-bundle actually spawns exactly this rev-list invocation, and does
the grepping internally.
There was a subtle bug in the latter step: it used fgets() with a
1024-byte buffer. If the user has sufficiently long subjects (e.g.,
by not adhering to the git oneline-subject convention in the first
place), the 'oneline' format can easily overflow the buffer. fgets()
then returns the rest of the line in the next call(s). If one of
these remaining parts started with '-', git-bundle would mistakenly
insert it into the bundle thinking it was a boundary commit.
Fix it by using strbuf_getwholeline() instead, which handles arbitrary
line lengths correctly.
Note that on the receiving side in parse_bundle_header() we were
already using strbuf_getwholeline_fd(), so that part is safe.
Reported-by: Jannis Pohlmann <jannis.pohlmann@codethink.co.uk>
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation/RelNotes/1.7.7.6.txt')
0 files changed, 0 insertions, 0 deletions