]> git.ipfire.org Git - thirdparty/git.git/commit - builtin/grep.c
object-file API: pass an enum to read_object_with_reference()
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Fri, 4 Feb 2022 23:48:34 +0000 (00:48 +0100)
committerJunio C Hamano <gitster@pobox.com>
Sat, 26 Feb 2022 01:16:32 +0000 (17:16 -0800)
commit6aea6baeb3ece6c832dbdf1deed09f41aebf85c2
treebcfb7909cdbe80e78dbe3cc4281b1a7a777a473b
parent2bbb28a3ee2f7252de02f5d0db4da79090b4f8fc
object-file API: pass an enum to read_object_with_reference()

Change the read_object_with_reference() function to take an "enum
object_type". It was not prepared to handle an arbitrary "const
char *type", as it was itself calling type_from_string().

Let's change the only caller that passes in user data to use
type_from_string(), and convert the rest to use e.g. "OBJ_TREE"
instead of "tree_type".

The "cat-file" caller is not on the codepath that
handles"--allow-unknown", so the type_from_string() there is safe. Its
use of type_from_string() doesn't functionally differ from that of the
pre-image.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/cat-file.c
builtin/fast-import.c
builtin/grep.c
builtin/pack-objects.c
cache.h
object-file.c
tree-walk.c