]> git.ipfire.org Git - thirdparty/git.git/commitdiff
mktag tests: test for-each-ref
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Thu, 17 Jun 2021 10:42:01 +0000 (12:42 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 28 Jun 2021 16:30:41 +0000 (09:30 -0700)
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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t3800-mktag.sh

index 67f6ecbe88126c5c363397e0a58e0e362d521e83..bb7130339959e6b6243dfda5d227c0715f79c001 100755 (executable)
@@ -78,6 +78,19 @@ check_verify_failure () {
                # will always fail.
                test_must_fail git -C bad-tag fsck
        '
+
+       test_expect_success "for-each-ref: $subject" '
+               # Make sure the earlier test created it for us
+               git rev-parse "$bad_tag" &&
+
+               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() {