From: Ævar Arnfjörð Bjarmason Date: Wed, 09 Dec 2020 20:01:40 GMT Subject: [PATCH v3 10/10] mktag: allow turning off fsck.extraHeaderEntry Message-ID: <20201209200140.29425-11-avarab@gmail.com> In-Reply-To: <20201126222257.5629-1-avarab@gmail.com> 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 --- Documentation/git-mktag.txt | 9 +++++++-- builtin/mktag.c | 11 ++++++++++- t/t3800-mktag.sh | 14 ++++++++++++++ 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/Documentation/git-mktag.txt b/Documentation/git-mktag.txt index b164ab563bd..e1506dde561 100644 --- a/Documentation/git-mktag.txt +++ b/Documentation/git-mktag.txt @@ -30,8 +30,13 @@ tag doesn't pass a linkgit:git-fsck[1] check. The "fsck" check done mktag is is stricter than what linkgit:git-fsck[1] would run by default in that all `fsck.` messages are promoted from warnings to errors (so e.g. a missing -"tagger" line is an error). Extra headers in the object are also an -error under mktag, but ignored by linkgit:git-fsck[1]. +"tagger" line is an error). + +Extra headers in the object are also an error under mktag, but ignored +by linkgit:git-fsck[1]. This extra check can be turned off by setting +the appropriate `fsck.` varible: + + git -c fsck.extraHeaderEntry=ignore mktag 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 <