summaryrefslogtreecommitdiff
path: root/t/t3800-mktag.sh
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2021-06-17 10:42:00 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-06-28 16:30:41 (GMT)
commiteddc1f556cd031d59b044ab655cdc591c6180e21 (patch)
tree0968abdca53982414439822a32984cb2cbfdaf8d /t/t3800-mktag.sh
parent47c0cb1a5db27dcf1c6117158b8152d1beacc9de (diff)
downloadgit-eddc1f556cd031d59b044ab655cdc591c6180e21.zip
git-eddc1f556cd031d59b044ab655cdc591c6180e21.tar.gz
git-eddc1f556cd031d59b044ab655cdc591c6180e21.tar.bz2
mktag tests: test update-ref and reachable fsck
Extend the mktag tests to pass the created bad tag through update-ref and fsck. The reason for passing it through update-ref is to guard against it having a segfault as for-each-ref did before c6854508808 (ref-filter: fix NULL check for parse object failure, 2021-04-01). Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t3800-mktag.sh')
-rwxr-xr-xt/t3800-mktag.sh21
1 files changed, 20 insertions, 1 deletions
diff --git a/t/t3800-mktag.sh b/t/t3800-mktag.sh
index 78c6f64..67f6ecb 100755
--- a/t/t3800-mktag.sh
+++ b/t/t3800-mktag.sh
@@ -44,11 +44,13 @@ check_verify_failure () {
'
test_expect_success "setup: $subject" '
+ tag_ref=refs/tags/bad_tag &&
+
# Reset any leftover state from the last $subject
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" '
@@ -59,6 +61,23 @@ check_verify_failure () {
test_must_fail git -C bad-tag fsck
fi
'
+
+ test_expect_success "update-ref & fsck reachable: $subject" '
+ # Make sure the earlier test created it for us
+ git rev-parse "$bad_tag" &&
+
+ # The update-ref of the bad content will fail, do it
+ # anyway to see if it segfaults
+ test_might_fail git -C bad-tag update-ref "$tag_ref" "$bad_tag" &&
+
+ # Manually create the broken, we cannot do it with
+ # update-ref
+ echo "$bad_tag" >"bad-tag/$tag_ref" &&
+
+ # Unlike fsck-ing unreachable content above, this
+ # will always fail.
+ test_must_fail git -C bad-tag fsck
+ '
}
test_expect_mktag_success() {