]> git.ipfire.org Git - thirdparty/git.git/commit
mktag tests: improve verify_object() test coverage
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Tue, 5 Jan 2021 19:42:41 +0000 (20:42 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 5 Jan 2021 22:58:29 +0000 (14:58 -0800)
commit30f882c16d64e9859d823db16ae7c5157f09397b
tree59d7cf5bf83583e970dfb477d7b3c1bb926293a2
parentca9a1ed969f09c8b6efc3e1d925ac1bda7370886
mktag tests: improve verify_object() test coverage

The verify_object() function in "mktag.c" is tasked with ensuring that
our tag refers to a valid object.

The existing test for this might fail because it was also testing that
"type taggg" didn't refer to a valid object type (it should be "type
tag"), or because we referred to a valid object but got the type
wrong.

Let's split these tests up, so we're testing all combinations of a
non-existing object and in invalid/wrong "type" lines.

We need to provide GIT_TEST_GETTEXT_POISON=false here because the
"invalid object type" error is emitted by
parse_loose_header_extended(), which has that message already marked
for translation. Another option would be to use test_i18ngrep, but I
prefer always running the test, not skipping it under gettext poison
testing.

I'm not testing this in combination with "git replace". That'll be
done in a subsequent commit.

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