git-commit-vandalism/t/oid-info/oid
Ævar Arnfjörð Bjarmason 59b8283d55 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 3e370f9faf (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>
2021-10-01 15:05:59 -07:00

32 lines
1.9 KiB
Plaintext

# These are some common invalid and partial object IDs used in tests.
001 sha1:0000000000000000000000000000000000000001
001 sha256:0000000000000000000000000000000000000000000000000000000000000001
002 sha1:0000000000000000000000000000000000000002
002 sha256:0000000000000000000000000000000000000000000000000000000000000002
003 sha1:0000000000000000000000000000000000000003
003 sha256:0000000000000000000000000000000000000000000000000000000000000003
004 sha1:0000000000000000000000000000000000000004
004 sha256:0000000000000000000000000000000000000000000000000000000000000004
005 sha1:0000000000000000000000000000000000000005
005 sha256:0000000000000000000000000000000000000000000000000000000000000005
006 sha1:0000000000000000000000000000000000000006
006 sha256:0000000000000000000000000000000000000000000000000000000000000006
007 sha1:0000000000000000000000000000000000000007
007 sha256:0000000000000000000000000000000000000000000000000000000000000007
# All zeros or Fs missing one or two hex segments.
zero_1 sha1:000000000000000000000000000000000000000
zero_1 sha256:000000000000000000000000000000000000000000000000000000000000000
zero_2 sha1:00000000000000000000000000000000000000
zero_2 sha256:00000000000000000000000000000000000000000000000000000000000000
ff_1 sha1:fffffffffffffffffffffffffffffffffffffff
ff_1 sha256:fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ff_2 sha1:ffffffffffffffffffffffffffffffffffffff
ff_2 sha256:ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
# More various invalid OIDs.
numeric sha1:0123456789012345678901234567890123456789
numeric sha256:0123456789012345678901234567890123456789012345678901234567890123
deadbeef sha1:deadbeefdeadbeefdeadbeefdeadbeefdeadbeef
deadbeef sha256:deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef
deadbeef_short sha1:deadbeefdeadbeefdeadbeefdeadbeefdeadbee
deadbeef_short sha256:deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbee