diff --color-moved-ws: demonstrate false positives
'diff --color-moved-ws=allow-indentation-change' can highlight lines
that have internal whitespace changes rather than indentation
changes. For example in commit 1a07e59c3e
("Update messages in
preparation for i18n", 2018-07-21) the lines
- die (_("must end with a color"));
+ die(_("must end with a color"));
are highlighted as moved when they should not be. Modify an existing
test to show the problem that will be fixed in the next commit.
Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Reviewed-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
b73bcbac4a
commit
10acc5f750
@ -1809,7 +1809,7 @@ test_expect_success 'only move detection ignores white spaces' '
|
|||||||
test_cmp expected actual
|
test_cmp expected actual
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'compare whitespace delta across moved blocks' '
|
test_expect_failure 'compare whitespace delta across moved blocks' '
|
||||||
|
|
||||||
git reset --hard &&
|
git reset --hard &&
|
||||||
q_to_tab <<-\EOF >text.txt &&
|
q_to_tab <<-\EOF >text.txt &&
|
||||||
@ -1827,6 +1827,7 @@ test_expect_success 'compare whitespace delta across moved blocks' '
|
|||||||
QQQthat has similar lines
|
QQQthat has similar lines
|
||||||
QQQto previous blocks, but with different indent
|
QQQto previous blocks, but with different indent
|
||||||
QQQYetQAnotherQoutlierQ
|
QQQYetQAnotherQoutlierQ
|
||||||
|
QLine with internal w h i t e s p a c e change
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
git add text.txt &&
|
git add text.txt &&
|
||||||
@ -1847,6 +1848,7 @@ test_expect_success 'compare whitespace delta across moved blocks' '
|
|||||||
QQthat has similar lines
|
QQthat has similar lines
|
||||||
QQto previous blocks, but with different indent
|
QQto previous blocks, but with different indent
|
||||||
QQYetQAnotherQoutlier
|
QQYetQAnotherQoutlier
|
||||||
|
QLine with internal whitespace change
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
git diff --color --color-moved --color-moved-ws=allow-indentation-change >actual.raw &&
|
git diff --color --color-moved --color-moved-ws=allow-indentation-change >actual.raw &&
|
||||||
@ -1856,7 +1858,7 @@ test_expect_success 'compare whitespace delta across moved blocks' '
|
|||||||
<BOLD>diff --git a/text.txt b/text.txt<RESET>
|
<BOLD>diff --git a/text.txt b/text.txt<RESET>
|
||||||
<BOLD>--- a/text.txt<RESET>
|
<BOLD>--- a/text.txt<RESET>
|
||||||
<BOLD>+++ b/text.txt<RESET>
|
<BOLD>+++ b/text.txt<RESET>
|
||||||
<CYAN>@@ -1,14 +1,14 @@<RESET>
|
<CYAN>@@ -1,15 +1,15 @@<RESET>
|
||||||
<BOLD;MAGENTA>-QIndented<RESET>
|
<BOLD;MAGENTA>-QIndented<RESET>
|
||||||
<BOLD;MAGENTA>-QText across<RESET>
|
<BOLD;MAGENTA>-QText across<RESET>
|
||||||
<BOLD;MAGENTA>-Qsome lines<RESET>
|
<BOLD;MAGENTA>-Qsome lines<RESET>
|
||||||
@ -1871,6 +1873,7 @@ test_expect_success 'compare whitespace delta across moved blocks' '
|
|||||||
<BOLD;MAGENTA>-QQQthat has similar lines<RESET>
|
<BOLD;MAGENTA>-QQQthat has similar lines<RESET>
|
||||||
<BOLD;MAGENTA>-QQQto previous blocks, but with different indent<RESET>
|
<BOLD;MAGENTA>-QQQto previous blocks, but with different indent<RESET>
|
||||||
<RED>-QQQYetQAnotherQoutlierQ<RESET>
|
<RED>-QQQYetQAnotherQoutlierQ<RESET>
|
||||||
|
<RED>-QLine with internal w h i t e s p a c e change<RESET>
|
||||||
<BOLD;CYAN>+<RESET>QQ<BOLD;CYAN>Indented<RESET>
|
<BOLD;CYAN>+<RESET>QQ<BOLD;CYAN>Indented<RESET>
|
||||||
<BOLD;CYAN>+<RESET>QQ<BOLD;CYAN>Text across<RESET>
|
<BOLD;CYAN>+<RESET>QQ<BOLD;CYAN>Text across<RESET>
|
||||||
<BOLD;CYAN>+<RESET>QQ<BOLD;CYAN>some lines<RESET>
|
<BOLD;CYAN>+<RESET>QQ<BOLD;CYAN>some lines<RESET>
|
||||||
@ -1885,6 +1888,7 @@ test_expect_success 'compare whitespace delta across moved blocks' '
|
|||||||
<BOLD;CYAN>+<RESET>QQ<BOLD;CYAN>that has similar lines<RESET>
|
<BOLD;CYAN>+<RESET>QQ<BOLD;CYAN>that has similar lines<RESET>
|
||||||
<BOLD;CYAN>+<RESET>QQ<BOLD;CYAN>to previous blocks, but with different indent<RESET>
|
<BOLD;CYAN>+<RESET>QQ<BOLD;CYAN>to previous blocks, but with different indent<RESET>
|
||||||
<GREEN>+<RESET>QQ<GREEN>YetQAnotherQoutlier<RESET>
|
<GREEN>+<RESET>QQ<GREEN>YetQAnotherQoutlier<RESET>
|
||||||
|
<GREEN>+<RESET>Q<GREEN>Line with internal whitespace change<RESET>
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
test_cmp expected actual
|
test_cmp expected actual
|
||||||
|
Loading…
Reference in New Issue
Block a user