summaryrefslogtreecommitdiff
path: root/diff.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-10-17 04:29:19 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-10-17 04:29:19 (GMT)
commit91ccfb85176fbe2ed416751ff7884cdaf61311cb (patch)
tree751cf5f7235e9a2eb10521a3224178500b01472a /diff.c
parentd1114d87c73c78a936975bef5f15e2cde639336d (diff)
parentfa5ba2c1dd0ce1bd060f423e7b1eb39d06fcd2cd (diff)
downloadgit-91ccfb85176fbe2ed416751ff7884cdaf61311cb.zip
git-91ccfb85176fbe2ed416751ff7884cdaf61311cb.tar.gz
git-91ccfb85176fbe2ed416751ff7884cdaf61311cb.tar.bz2
Merge branch 'sb/diff-color-move'
A recently added "--color-moved" feature of "diff" fell into infinite loop when ignoring whitespace changes, which has been fixed. * sb/diff-color-move: diff: fix infinite loop with --color-moved --ignore-space-change
Diffstat (limited to 'diff.c')
-rw-r--r--diff.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/diff.c b/diff.c
index 69f0357..d76bb93 100644
--- a/diff.c
+++ b/diff.c
@@ -712,20 +712,22 @@ static int next_byte(const char **cp, const char **endp,
if (*cp > *endp)
return -1;
- if (DIFF_XDL_TST(diffopt, IGNORE_WHITESPACE_CHANGE)) {
- while (*cp < *endp && isspace(**cp))
- (*cp)++;
- /*
- * After skipping a couple of whitespaces, we still have to
- * account for one space.
- */
- return (int)' ';
- }
+ if (isspace(**cp)) {
+ if (DIFF_XDL_TST(diffopt, IGNORE_WHITESPACE_CHANGE)) {
+ while (*cp < *endp && isspace(**cp))
+ (*cp)++;
+ /*
+ * After skipping a couple of whitespaces,
+ * we still have to account for one space.
+ */
+ return (int)' ';
+ }
- if (DIFF_XDL_TST(diffopt, IGNORE_WHITESPACE)) {
- while (*cp < *endp && isspace(**cp))
- (*cp)++;
- /* return the first non-ws character via the usual below */
+ if (DIFF_XDL_TST(diffopt, IGNORE_WHITESPACE)) {
+ while (*cp < *endp && isspace(**cp))
+ (*cp)++;
+ /* return the first non-ws character via the usual below */
+ }
}
retval = (unsigned char)(**cp);