1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-27 15:46:14 +02:00
git/t/oid-info
Æ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
..
README object-file.c: rename from sha1-file.c 2021-01-04 13:01:55 -08:00
hash-info
oid cat-file tests: test for missing/bogus object with -t, -s and -p 2021-10-01 15:05:59 -07:00

This directory contains various per-hash values that are used in the testsuite.

Each file contains lines containing a key-value pair; blank lines and lines
starting with `#` are ignored.  The key and value are separated by whitespace
(specifically, those whitespace in the default `$IFS`).  The key consists only
of shell identifier characters, and the value consists of a hash algorithm,
colon, and value.  The hash algorithm also consists only of shell identifier
characters; it should match the value in object-file.c.

For example, the following lines map the key "rawsz" to "20" if SHA-1 is in use
and to "32" if SHA-256 is in use:

----
rawsz sha1:20
rawsz sha256:32
----

The keys and values used here are loaded by `test_oid_init` (see the README file
in the "t" directory) and are used by calling `test_oid`.