mirror of
https://github.com/git/git.git
synced 2026-01-09 17:46:37 +00:00
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>
This commit is contained in:
committed by
Junio C Hamano
parent
2bbb28a3ee
commit
6aea6baeb3
@@ -89,7 +89,7 @@ void *fill_tree_descriptor(struct repository *r,
|
||||
void *buf = NULL;
|
||||
|
||||
if (oid) {
|
||||
buf = read_object_with_reference(r, oid, tree_type, &size, NULL);
|
||||
buf = read_object_with_reference(r, oid, OBJ_TREE, &size, NULL);
|
||||
if (!buf)
|
||||
die("unable to read tree %s", oid_to_hex(oid));
|
||||
}
|
||||
@@ -605,7 +605,7 @@ int get_tree_entry(struct repository *r,
|
||||
unsigned long size;
|
||||
struct object_id root;
|
||||
|
||||
tree = read_object_with_reference(r, tree_oid, tree_type, &size, &root);
|
||||
tree = read_object_with_reference(r, tree_oid, OBJ_TREE, &size, &root);
|
||||
if (!tree)
|
||||
return -1;
|
||||
|
||||
@@ -677,7 +677,7 @@ enum get_oid_result get_tree_entry_follow_symlinks(struct repository *r,
|
||||
unsigned long size;
|
||||
tree = read_object_with_reference(r,
|
||||
¤t_tree_oid,
|
||||
tree_type, &size,
|
||||
OBJ_TREE, &size,
|
||||
&root);
|
||||
if (!tree)
|
||||
goto done;
|
||||
|
||||
Reference in New Issue
Block a user