summaryrefslogtreecommitdiff
path: root/git-rebase.sh
diff options
context:
space:
mode:
authorLibravatar Jeff King <peff@peff.net>2017-10-12 20:18:37 -0400
committerLibravatar Junio C Hamano <gitster@pobox.com>2017-10-16 11:57:45 +0900
commitfa5ba2c1dd0ce1bd060f423e7b1eb39d06fcd2cd (patch)
treeecd489b63eb5312408ff2c54b98f0d872db1a068 /git-rebase.sh
parentdiff: correct newline in summary for renamed files (diff)
downloadtgif-fa5ba2c1dd0ce1bd060f423e7b1eb39d06fcd2cd.tar.xz
diff: fix infinite loop with --color-moved --ignore-space-change
The --color-moved code uses next_byte() to advance through the blob contents. When the user has asked to ignore whitespace changes, we try to collapse any whitespace change down to a single space. However, we enter the conditional block whenever we see the IGNORE_WHITESPACE_CHANGE flag, even if the next byte isn't whitespace. This means that the combination of "--color-moved and --ignore-space-change" was completely broken. Worse, because we return from next_byte() without having advanced our pointer, the function makes no forward progress in the buffer and loops infinitely. Fix this by entering the conditional only when we actually see whitespace. We can apply this also to the IGNORE_WHITESPACE change. That code path isn't buggy (because it falls through to returning the next non-whitespace byte), but it makes the logic more clear if we only bother to look at whitespace flags after seeing that the next byte is whitespace. Reported-by: Orgad Shaneh <orgads@gmail.com> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-rebase.sh')
0 files changed, 0 insertions, 0 deletions