Thread (16 messages) 16 messages, 2 authors, 2021-06-17

[PATCH 5/6] mktag tests: test for-each-ref

flat view
STALE1937d

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2021-06-14 17:29:49
Subsystem: the rest · Maintainer: Linus Torvalds

Revision v1 of 2 in this series.

Revisions (2)
  1. v1 current
  2. v2 [diff vs current]
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 <redacted>
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help