[PATCH] tests: test show --word-diff --color-moved
- From
Michael J Gruber <git@grubix.eu>
- Date
- Mar 17, 2022, 12:46 UTC
- Message-ID
- <a5e5cdd4658d457ffbd80f7263e352cbf3141a1a.1647520853.git.git@grubix.eu>
- In-Reply-To
- <220304.861qzhftzc.gmgdl@evledraar.gmail.com>
a18d66cefb ("diff.c: free "buf" in diff_words_flush()", 2022-03-04) introduced a breakage to `show --word-diff --color-moved` which gives
free(): double free detected in tcache 2 Aborted (core dumped)
on every incarnation. This was not caught by the test suite because we test `diff --word-diff --color-moved` only so far.
Therefore, add a test for `show`, too.
Reverting a18d66cefb makes the test pass, but there might be a better fix.
Signed-off-by: Michael J Gruber <git@grubix.eu> --- t/t4015-diff-whitespace.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/t/t4015-diff-whitespace.sh b/t/t4015-diff-whitespace.sh index 9babf13bc9..ff8a0426ca 100755 --- a/t/t4015-diff-whitespace.sh +++ b/t/t4015-diff-whitespace.sh @@ -1622,7 +1622,7 @@ test_expect_success 'cmd option assumes configured colored-moved' ' test_cmp expected actual ' -test_expect_success 'no effect from --color-moved with --word-diff' ' +test_expect_success 'no effect on diff from --color-moved with --word-diff' ' cat <<-\EOF >text.txt && Lorem Ipsum is simply dummy text of the printing and typesetting industry. EOF @@ -1636,6 +1636,12 @@ test_expect_success 'no effect from --color-moved with --word-diff' ' test_cmp expect actual ' +test_expect_failure 'no effect on show from --color-moved with --word-diff' ' + git show --color-moved --word-diff >actual && + git show --word-diff >expect && + test_cmp expect actual +' + test_expect_success 'set up whitespace tests' ' git reset --hard && # Note that these lines have no leading or trailing whitespace.
-- 2.35.1.981.gd72fe90d09