[PATCH v2 4/5] mktag tests: test for maybe segfaulting for-each-ref
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- Apr 1, 2021, 13:56 UTC
- Message-ID
- <patch-4.6-403024b1cca-20210401T135419Z-avarab@gmail.com>
- In-Reply-To
- <cover-0.6-00000000000-20210401T135419Z-avarab@gmail.com>
Add a test to check that "for-each-ref" fails on a repository with a bad tag, this test intentionally uses "! " instead of "test_must_fail " to hide a segfault. We'll fix the underlying bug in a subsequent commit and convert it to "test_must_fail".
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> --- t/t3800-mktag.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/t/t3800-mktag.sh b/t/t3800-mktag.sh index 4673235b1fd..10e4fde28de 100755 --- a/t/t3800-mktag.sh +++ b/t/t3800-mktag.sh @@ -58,7 +58,13 @@ check_verify_failure () { # The update-ref command itself might fail, but we are # not testing that echo "$bad_tag" >"bad-tag/.git/$tag_ref" && - test_must_fail git -C bad-tag fsck + test_must_fail git -C bad-tag fsck && + + 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 && + # segfaults! + ! git -C bad-tag for-each-ref --format="%(*objectname)" ' }
-- 2.31.1.474.g72d45d12706