git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael J Gruber <git@grubix.eu>
To: git@vger.kernel.org
Cc: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: [PATCH] tests: test show --word-diff --color-moved
Date: Thu, 17 Mar 2022 13:46:06 +0100	[thread overview]
Message-ID: <a5e5cdd4658d457ffbd80f7263e352cbf3141a1a.1647520853.git.git@grubix.eu> (raw)
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


  reply	other threads:[~2022-03-17 12:58 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-04  4:31 What's cooking in git.git (Mar 2022, #01; Thu, 3) Junio C Hamano
2022-03-04 13:25 ` ab/plug-random-leaks (was Re: What's cooking in git.git (Mar 2022, #01; Thu, 3)) Derrick Stolee
2022-03-04 18:33   ` Ævar Arnfjörð Bjarmason
2022-03-17 12:46     ` Michael J Gruber [this message]
2022-03-17 14:55       ` [PATCH v2 0/2] diff.c: fix a recent memory leak regression Ævar Arnfjörð Bjarmason
2022-03-17 14:55         ` [PATCH v2 1/2] tests: demonstrate "show --word-diff --color-moved" regression Ævar Arnfjörð Bjarmason
2022-03-17 15:54           ` Junio C Hamano
2022-03-17 14:55         ` [PATCH v2 2/2] diff.c: fix a double-free regression in a18d66cefb Ævar Arnfjörð Bjarmason
2022-03-04 15:35 ` tb/cruft-packs (was Re: What's cooking in git.git (Mar 2022, #01; Thu, 3)) Derrick Stolee
2022-03-07 18:06   ` Jonathan Nieder
2022-03-07 18:18     ` Taylor Blau
2022-03-07 18:32       ` Derrick Stolee
2022-03-07 20:18         ` Jonathan Nieder
2022-03-07 20:51           ` Derrick Stolee
2022-03-07 21:34             ` Junio C Hamano
2022-03-08  0:52               ` Taylor Blau
2022-03-08  0:25       ` Junio C Hamano
2022-03-08  0:49         ` Taylor Blau
2022-03-05 14:25 ` jc/stash-drop (was: " Ævar Arnfjörð Bjarmason
2022-03-07 18:22   ` jc/stash-drop Junio C Hamano
2022-03-07 13:49 ` ds/commit-graph-gen-v2-fixes (was Re: What's cooking in git.git (Mar 2022, #01; Thu, 3)) Derrick Stolee
2022-03-07 17:18   ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a5e5cdd4658d457ffbd80f7263e352cbf3141a1a.1647520853.git.git@grubix.eu \
    --to=git@grubix.eu \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).