diff --git a/t/t4015-diff-whitespace.sh b/t/t4015-diff-whitespace.sh index 503c9bc7f3..1f54816c6b 100755 --- a/t/t4015-diff-whitespace.sh +++ b/t/t4015-diff-whitespace.sh @@ -1399,6 +1399,70 @@ test_expect_success 'move detection ignoring whitespace ' ' test_cmp expected actual ' +test_expect_success 'move detection ignoring whitespace changes' ' + git reset --hard && + # Lines 6-8 have a space change, but 9 is new whitespace + q_to_tab <<-\EOF >lines.txt && + longQline 6 + longQline 7 + longQline 8 + long liQne 9 + line 1 + line 2 + line 3 + line 4 + line 5 + EOF + + git diff HEAD --no-renames --color-moved --color | + grep -v "index" | + test_decode_color >actual && + cat <<-\EOF >expected && + diff --git a/lines.txt b/lines.txt + --- a/lines.txt + +++ b/lines.txt + @@ -1,9 +1,9 @@ + +long line 6 + +long line 7 + +long line 8 + +long li ne 9 + line 1 + line 2 + line 3 + line 4 + line 5 + -long line 6 + -long line 7 + -long line 8 + -long line 9 + EOF + test_cmp expected actual && + + git diff HEAD --no-renames -b --color-moved --color | + grep -v "index" | + test_decode_color >actual && + cat <<-\EOF >expected && + diff --git a/lines.txt b/lines.txt + --- a/lines.txt + +++ b/lines.txt + @@ -1,9 +1,9 @@ + +long line 6 + +long line 7 + +long line 8 + +long li ne 9 + line 1 + line 2 + line 3 + line 4 + line 5 + -long line 6 + -long line 7 + -long line 8 + -long line 9 + EOF + test_cmp expected actual +' + test_expect_success 'clean up whitespace-test colors' ' git config --unset color.diff.oldMoved && git config --unset color.diff.newMoved @@ -1549,13 +1613,4 @@ test_expect_success 'move detection with submodules' ' test_cmp expect decoded_actual ' -test_expect_success 'move detection with whitespace changes' ' - test_when_finished "git reset --hard" && - test_seq 10 >test && - git add test && - sed s/3/42/ test.tmp && - mv test.tmp test && - git -c diff.colormoved diff --ignore-space-change -- test -' - test_done