]> git.ipfire.org Git - thirdparty/git.git/commit
mktag: allow omitting the header/body \n separator
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Tue, 5 Jan 2021 19:42:49 +0000 (20:42 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 5 Jan 2021 22:58:29 +0000 (14:58 -0800)
commit9a1a3a4d4c5648b94dbe8f34b83271d96dbaa6ec
treecd8de67b32e521358625d1e28c1686b2eeb6e487
parentacfc01332bc477e19b8af6b5002c0b962fde3326
mktag: allow omitting the header/body \n separator

Change mktag's acceptance rules to accept an empty body without an
empty line after the header again. This fixes an ancient unintended
dregression in "mktag".

When "mktag" was introduced in ec4465adb3 (Add "tag" objects that can
be used to sign other objects., 2005-04-25) the input checks were much
looser. When it was documented it 6cfec03680 (mktag: minimally update
the description., 2007-06-10) it was clearly intended for this \n to
be optional:

    The message, when [it] exists, is separated by a blank line from
    the header.

But then in e0aaf781f6 (mktag.c: improve verification of tagger field
and tests, 2008-03-27) this was made an error, seemingly by
accident. It was just a result of the general header checks, and all
the tests after that patch have a trailing empty line (but did not
before).

Let's allow this again, and tweak the test semantics changed in
e0aaf781f6 to remove the redundant empty line. New tests added in
previous commits of mine already added an explicit test for allowing
the empty line between header and body.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
fsck.c
t/t3800-mktag.sh