git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>,
	"Olga Telezhnaya" <olyatelezhnaya@gmail.com>,
	"Jeff King" <peff@peff.net>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: [PATCH 5/6] mktag tests: test for-each-ref
Date: Mon, 14 Jun 2021 19:28:22 +0200	[thread overview]
Message-ID: <patch-5.6-8a626fc63a1-20210614T172422Z-avarab@gmail.com> (raw)
In-Reply-To: <cover-0.6-00000000000-20210614T172422Z-avarab@gmail.com>

Add a "for-each-ref" for all the mktag tests. This test would have
caught the segfault which was fixed in c6854508808 (ref-filter: fix
NULL check for parse object failure, 2021-04-01). Let's make sure we
test that code more exhaustively.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 t/t3800-mktag.sh | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/t/t3800-mktag.sh b/t/t3800-mktag.sh
index f5a51d11f81..7d0ad3c8e62 100755
--- a/t/t3800-mktag.sh
+++ b/t/t3800-mktag.sh
@@ -50,7 +50,7 @@ check_verify_failure () {
 		rm -rf bad-tag &&
 
 		git init --bare bad-tag &&
-		git -C bad-tag hash-object -t tag -w --stdin --literally <tag.sig
+		bad_tag=$(git -C bad-tag hash-object -t tag -w --stdin --literally <tag.sig)
 	'
 
 	test_expect_success "hash-object & fsck unreachable: $subject" '
@@ -75,6 +75,16 @@ check_verify_failure () {
 		# will always fail.
 		test_must_fail git -C bad-tag fsck
 	'
+
+	test_expect_success "for-each-ref: $subject" '
+		echo "$bad_tag" >"bad-tag/$tag_ref" &&
+
+		printf "%s tag\t%s\n" "$bad_tag" "$tag_ref" >expected &&
+		git -C bad-tag for-each-ref "$tag_ref" >actual &&
+		test_cmp expected actual &&
+
+		test_must_fail git -C bad-tag for-each-ref --format="%(*objectname)"
+	'
 }
 
 test_expect_mktag_success() {
-- 
2.32.0.555.g0268d380f7b


  parent reply	other threads:[~2021-06-14 17:29 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-14 17:28 [PATCH 0/6] mktag tests: test more exhaustively Ævar Arnfjörð Bjarmason
2021-06-14 17:28 ` [PATCH 1/6] mktag tests: parse out options in helper Ævar Arnfjörð Bjarmason
2021-06-14 17:28 ` [PATCH 2/6] mktag tests: invert --no-strict test Ævar Arnfjörð Bjarmason
2021-06-14 17:28 ` [PATCH 3/6] mktag tests: test hash-object --literally and unreachable fsck Ævar Arnfjörð Bjarmason
2021-06-15 10:34   ` Andrei Rybak
2021-06-15 14:41     ` Ævar Arnfjörð Bjarmason
2021-06-14 17:28 ` [PATCH 4/6] mktag tests: test update-ref and reachable fsck Ævar Arnfjörð Bjarmason
2021-06-14 17:28 ` Ævar Arnfjörð Bjarmason [this message]
2021-06-14 17:28 ` [PATCH 6/6] mktag tests: test fast-export Ævar Arnfjörð Bjarmason
2021-06-15  3:06 ` [PATCH 0/6] mktag tests: test more exhaustively Junio C Hamano
2021-06-17 10:41 ` [PATCH v2 " Ævar Arnfjörð Bjarmason
2021-06-17 10:41   ` [PATCH v2 1/6] mktag tests: parse out options in helper Ævar Arnfjörð Bjarmason
2021-06-17 10:41   ` [PATCH v2 2/6] mktag tests: invert --no-strict test Ævar Arnfjörð Bjarmason
2021-06-17 10:41   ` [PATCH v2 3/6] mktag tests: test hash-object --literally and unreachable fsck Ævar Arnfjörð Bjarmason
2021-06-17 10:42   ` [PATCH v2 4/6] mktag tests: test update-ref and reachable fsck Ævar Arnfjörð Bjarmason
2021-06-17 10:42   ` [PATCH v2 5/6] mktag tests: test for-each-ref Ævar Arnfjörð Bjarmason
2021-06-17 10:42   ` [PATCH v2 6/6] mktag tests: test fast-export Ævar Arnfjörð Bjarmason

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=patch-5.6-8a626fc63a1-20210614T172422Z-avarab@gmail.com \
    --to=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=olyatelezhnaya@gmail.com \
    --cc=peff@peff.net \
    /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).