N_("git mktag"),
NULL
};
+static int option_strict = 1;
static struct fsck_options fsck_options = FSCK_OPTIONS_STRICT;
{
switch (msg_type) {
case FSCK_WARN:
+ if (!option_strict) {
+ fprintf_ln(stderr, _("warning: tag input does not pass fsck: %s"), message);
+ return 0;
+
+ }
+ /* fallthrough */
case FSCK_ERROR:
/*
* We treat both warnings and errors as errors, things
int cmd_mktag(int argc, const char **argv, const char *prefix)
{
static struct option builtin_mktag_options[] = {
+ OPT_BOOL(0, "strict", &option_strict,
+ N_("enable more strict checking")),
OPT_END(),
};
struct strbuf buf = STRBUF_INIT;
# given in the expect.pat file.
check_verify_failure () {
- expect="$2"
- test_expect_success "$1" '
+ test_expect_success "$1" "
test_must_fail env GIT_TEST_GETTEXT_POISON=false \
git mktag <tag.sig 2>message &&
- grep "$expect" message
- '
+ grep '$2' message &&
+ if test '$3' != '--no-strict'
+ then
+ test_must_fail env GIT_TEST_GETTEXT_POISON=false \
+ git mktag --no-strict <tag.sig 2>message.no-strict &&
+ grep '$2' message.no-strict
+ fi
+ "
}
test_expect_mktag_success() {
EOF
check_verify_failure 'Tag object length check' \
- '^error:.* missingObject:'
+ '^error:.* missingObject:' 'strict'
############################################################
# 2. object line label check
EOF
check_verify_failure 'verify tag-name check' \
- '^error:.* badTagName:'
+ '^error:.* badTagName:' '--no-strict'
############################################################
# 11. tagger line label check #1
EOF
check_verify_failure '"tagger" line label check #1' \
- '^error:.* missingTaggerEntry:'
+ '^error:.* missingTaggerEntry:' '--no-strict'
############################################################
# 12. tagger line label check #2
EOF
check_verify_failure '"tagger" line label check #2' \
- '^error:.* missingTaggerEntry:'
+ '^error:.* missingTaggerEntry:' '--no-strict'
############################################################
# 13. allow missing tag author name like fsck
EOF
check_verify_failure 'disallow malformed tagger' \
- '^error:.* badEmail:'
+ '^error:.* badEmail:' '--no-strict'
############################################################
# 15. allow empty tag email
EOF
check_verify_failure 'detect invalid header entry' \
- '^error:.* extraHeaderEntry:'
+ '^error:.* extraHeaderEntry:' '--no-strict'
test_expect_success 'invalid header entry config & fsck' '
test_must_fail git mktag <tag.sig &&
+ git mktag --no-strict <tag.sig &&
+
test_must_fail git -c fsck.extraHeaderEntry=error mktag <tag.sig &&
+ test_must_fail git -c fsck.extraHeaderEntry=error mktag --no-strict <tag.sig &&
+
test_must_fail git -c fsck.extraHeaderEntry=warn mktag <tag.sig &&
+ git -c fsck.extraHeaderEntry=warn mktag --no-strict <tag.sig &&
+
git -c fsck.extraHeaderEntry=ignore mktag <tag.sig &&
+ git -c fsck.extraHeaderEntry=ignore mktag --no-strict <tag.sig &&
+
git fsck &&
env GIT_TEST_GETTEXT_POISON=false \
git -c fsck.extraHeaderEntry=warn fsck 2>err &&