message=$2 &&
shift 2 &&
+ no_strict= &&
+ fsck_obj_ok= &&
no_strict= &&
while test $# != 0
do
--no-strict)
no_strict=yes
;;
+ --fsck-obj-ok)
+ fsck_obj_ok=yes
+ ;;
esac &&
shift
done &&
git mktag --no-strict <tag.sig
fi
'
+
+ test_expect_success "setup: $subject" '
+ # 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
+ '
+
+ test_expect_success "hash-object & fsck unreachable: $subject" '
+ if test -n "$fsck_obj_ok"
+ then
+ git -C bad-tag fsck
+ else
+ test_must_fail git -C bad-tag fsck
+ fi
+ '
}
test_expect_mktag_success() {
EOF
check_verify_failure 'verify object (hash/type) check -- correct type, nonexisting object' \
- '^fatal: could not read tagged object'
+ '^fatal: could not read tagged object' \
+ --fsck-obj-ok
cat >tag.sig <<EOF
object $head
EOF
check_verify_failure 'verify object (hash/type) check -- mismatched type, valid object' \
- '^fatal: object.*tagged as.*tree.*but is.*commit'
+ '^fatal: object.*tagged as.*tree.*but is.*commit' \
+ --fsck-obj-ok
############################################################
# 9.5. verify object (hash/type) check -- replacement
EOF
check_verify_failure 'verify object (hash/type) check -- mismatched type, valid object' \
- '^fatal: object.*tagged as.*tree.*but is.*blob'
+ '^fatal: object.*tagged as.*tree.*but is.*blob' \
+ --fsck-obj-ok
############################################################
# 10. verify tag-name check
check_verify_failure 'verify tag-name check' \
'^error:.* badTagName:' \
- --no-strict
+ --no-strict \
+ --fsck-obj-ok
############################################################
# 11. tagger line label check #1
check_verify_failure '"tagger" line label check #1' \
'^error:.* missingTaggerEntry:' \
- --no-strict
+ --no-strict \
+ --fsck-obj-ok
############################################################
# 12. tagger line label check #2
check_verify_failure '"tagger" line label check #2' \
'^error:.* missingTaggerEntry:' \
- --no-strict
+ --no-strict \
+ --fsck-obj-ok
############################################################
# 13. allow missing tag author name like fsck
check_verify_failure 'disallow malformed tagger' \
'^error:.* badEmail:' \
- --no-strict
+ --no-strict \
+ --fsck-obj-ok
############################################################
# 15. allow empty tag email
check_verify_failure 'detect invalid header entry' \
'^error:.* extraHeaderEntry:' \
- --no-strict
+ --no-strict \
+ --fsck-obj-ok
test_expect_success 'invalid header entry config & fsck' '
test_must_fail git mktag <tag.sig &&