git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[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
Previous: Ævar Arnfjörð BjarmasonNext: Ævar Arnfjörð Bjarmason
Message 4 of 22 in “What's cooking in git.git (Mar 2022, #01; Thu, 3)”
  1. Junio C HamanoMar 4, 2022
  2. ab/plug-random-leaks (was Re: What's cooking in git.git (Mar 2022, #01; Thu, 3))Derrick Stolee, Mar 4, 2022
  3. Ævar Arnfjörð BjarmasonMar 4, 2022
  4. tests: test show --word-diff --color-movedMichael J Gruber, Mar 17, 2022
  5. 0/2 diff.c: fix a recent memory leak regressionÆvar Arnfjörð Bjarmason, Mar 17, 2022
  6. 2/2 diff.c: fix a double-free regression in a18d66cefbÆvar Arnfjörð Bjarmason, Mar 17, 2022
  7. 1/2 tests: demonstrate "show --word-diff --color-moved" regressionÆvar Arnfjörð Bjarmason, Mar 17, 2022
  8. Junio C HamanoMar 17, 2022
  9. tb/cruft-packs (was Re: What's cooking in git.git (Mar 2022, #01; Thu, 3))Derrick Stolee, Mar 4, 2022
  10. Jonathan NiederMar 7, 2022
  11. Taylor BlauMar 7, 2022
  12. Derrick StoleeMar 7, 2022
  13. Jonathan NiederMar 7, 2022
  14. Derrick StoleeMar 7, 2022
  15. Junio C HamanoMar 7, 2022
  16. Taylor BlauMar 8, 2022
  17. Junio C HamanoMar 8, 2022
  18. Taylor BlauMar 8, 2022
  19. jc/stash-drop (was: What's cooking in git.git (Mar 2022, #01; Thu, 3))Ævar Arnfjörð Bjarmason, Mar 5, 2022
  20. Junio C HamanoMar 7, 2022
  21. ds/commit-graph-gen-v2-fixes (was Re: What's cooking in git.git (Mar 2022, #01; Thu, 3))Derrick Stolee, Mar 7, 2022
  22. Junio C HamanoMar 7, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.