Skip to content

Commit 9a01387

Browse files
committed
Merge branch 'kc/maint-diff-bwi-fix'
* kc/maint-diff-bwi-fix: Fix combined use of whitespace ignore options to diff
2 parents 36dd939 + 6d12ace commit 9a01387

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

t/t4015-diff-whitespace.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,11 @@ EOF
9999
git diff -w > out
100100
test_expect_success 'another test, with -w' 'test_cmp expect out'
101101
git diff -w -b > out
102-
test_expect_failure 'another test, with -w -b' 'test_cmp expect out'
102+
test_expect_success 'another test, with -w -b' 'test_cmp expect out'
103103
git diff -w --ignore-space-at-eol > out
104-
test_expect_failure 'another test, with -w --ignore-space-at-eol' 'test_cmp expect out'
104+
test_expect_success 'another test, with -w --ignore-space-at-eol' 'test_cmp expect out'
105105
git diff -w -b --ignore-space-at-eol > out
106-
test_expect_failure 'another test, with -w -b --ignore-space-at-eol' 'test_cmp expect out'
106+
test_expect_success 'another test, with -w -b --ignore-space-at-eol' 'test_cmp expect out'
107107

108108
tr 'Q' '\015' << EOF > expect
109109
diff --git a/x b/x
@@ -123,7 +123,7 @@ EOF
123123
git diff -b > out
124124
test_expect_success 'another test, with -b' 'test_cmp expect out'
125125
git diff -b --ignore-space-at-eol > out
126-
test_expect_failure 'another test, with -b --ignore-space-at-eol' 'test_cmp expect out'
126+
test_expect_success 'another test, with -b --ignore-space-at-eol' 'test_cmp expect out'
127127

128128
tr 'Q' '\015' << EOF > expect
129129
diff --git a/x b/x

xdiff/xutils.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,12 +245,14 @@ static unsigned long xdl_hash_record_with_whitespace(char const **data,
245245
while (ptr + 1 < top && isspace(ptr[1])
246246
&& ptr[1] != '\n')
247247
ptr++;
248-
if (flags & XDF_IGNORE_WHITESPACE_CHANGE
248+
if (flags & XDF_IGNORE_WHITESPACE)
249+
; /* already handled */
250+
else if (flags & XDF_IGNORE_WHITESPACE_CHANGE
249251
&& ptr[1] != '\n') {
250252
ha += (ha << 5);
251253
ha ^= (unsigned long) ' ';
252254
}
253-
if (flags & XDF_IGNORE_WHITESPACE_AT_EOL
255+
else if (flags & XDF_IGNORE_WHITESPACE_AT_EOL
254256
&& ptr[1] != '\n') {
255257
while (ptr2 != ptr + 1) {
256258
ha += (ha << 5);

0 commit comments

Comments
 (0)