]> git.ipfire.org Git - thirdparty/git.git/commit - t/oid-info/oid
cat-file tests: test for missing/bogus object with -t, -s and -p
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Fri, 1 Oct 2021 09:16:42 +0000 (11:16 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 1 Oct 2021 22:05:59 +0000 (15:05 -0700)
commit59b8283d557a00d0c09684e621f5e000e6996b5f
treeea7b76c77f6187b4acdfeb62dc3558a6b15087aa
parent70e4a57762e7a23af8772483026b1e00f9de296b
cat-file tests: test for missing/bogus object with -t, -s and -p

When we look up a missing object with cat_one_file() what error we
print out currently depends on whether we'll error out early in
get_oid_with_context(), or if we'll get an error later from
oid_object_info_extended().

The --allow-unknown-type flag then changes whether we pass the
"OBJECT_INFO_ALLOW_UNKNOWN_TYPE" flag to get_oid_with_context() or
not.

The "-p" flag is yet another special-case in printing the same output
on the deadbeef OID as we'd emit on the deadbeef_short OID for the
"-s" and "-t" options, it also doesn't support the
"--allow-unknown-type" flag at all.

Let's test the combination of the two sets of [-t, -s, -p] and
[--{no-}allow-unknown-type] (the --no-allow-unknown-type is implicit
in not supplying it), as well as a [missing,bogus] object pair.

This extends tests added in 3e370f9faf0 (t1006: add tests for git
cat-file --allow-unknown-type, 2015-05-03).

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/oid-info/oid
t/t1006-cat-file.sh