summaryrefslogtreecommitdiff
path: root/t/t3800-mktag.sh
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2021-01-05 19:42:48 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-01-05 22:58:29 (GMT)
commitacfc01332bc477e19b8af6b5002c0b962fde3326 (patch)
tree2cecf36cb27903de43281bc2c44db4dfea80cec5 /t/t3800-mktag.sh
parent1f3299fda9d0800d8e882540d36e4d78797e998e (diff)
downloadgit-acfc01332bc477e19b8af6b5002c0b962fde3326.zip
git-acfc01332bc477e19b8af6b5002c0b962fde3326.tar.gz
git-acfc01332bc477e19b8af6b5002c0b962fde3326.tar.bz2
mktag: allow turning off fsck.extraHeaderEntry
In earlier commits mktag learned to use the fsck machinery, at which point we needed to add fsck.extraHeaderEntry so it could be as strict about extra headers as it's been ever since it was implemented. But it's not nice to need to switch away from "mktag" to "hash-object" + manual "fsck" just because you'd like to have an extra header. So let's support turning it off by getting "fsck.*" variables from the config. Pedantically speaking it's still not possible to make "mktag" behave just like "hash-object -t tag" does, since we're unconditionally going to check the referenced object in verify_object_in_tag(), which is our own check, and not one that exists in fsck.c. But the spirit of "this works like fsck" is preserved, in that if you created such a tag with "hash-object" and did a full "fsck" on the repository it would also error out about that invalid object, it just wouldn't emit the same message as fsck does. 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.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/t/t3800-mktag.sh b/t/t3800-mktag.sh
index 5e96f69..929bb9f 100755
--- a/t/t3800-mktag.sh
+++ b/t/t3800-mktag.sh
@@ -412,6 +412,20 @@ EOF
check_verify_failure 'detect invalid header entry' \
'^error:.* extraHeaderEntry:'
+test_expect_success 'invalid header entry config & fsck' '
+ test_must_fail git mktag <tag.sig &&
+ test_must_fail git -c fsck.extraHeaderEntry=error mktag <tag.sig &&
+ test_must_fail git -c fsck.extraHeaderEntry=warn mktag <tag.sig &&
+ git -c fsck.extraHeaderEntry=ignore mktag <tag.sig &&
+ git fsck &&
+ env GIT_TEST_GETTEXT_POISON=false \
+ git -c fsck.extraHeaderEntry=warn fsck 2>err &&
+ grep "warning .*extraHeaderEntry:" err &&
+ test_must_fail env GIT_TEST_GETTEXT_POISON=false \
+ git -c fsck.extraHeaderEntry=error 2>err fsck &&
+ grep "error .* extraHeaderEntry:" err
+'
+
cat >tag.sig <<EOF
object $head
type commit