odb: rename read_object_with_reference()

Rename `read_object_with_reference()` to `odb_read_object_peeled()` to
match other functions related to the object database and our modern
coding guidelines. Furthermore though, the old name didn't really
describe very well what this function actually does, which is to walk
down any commit and tag objects until an object of the required type has
been found. This is generally referred to as "peeling", so the new name
should be way more descriptive.

No compatibility wrapper is introduced as the function is not used a lot
throughout our codebase.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Patrick Steinhardt
2025-07-01 14:22:29 +02:00
committed by Junio C Hamano
parent 08218b8cd4
commit 841a03b404
8 changed files with 37 additions and 45 deletions

View File

@@ -90,7 +90,7 @@ void *fill_tree_descriptor(struct repository *r,
void *buf = NULL;
if (oid) {
buf = read_object_with_reference(r, oid, OBJ_TREE, &size, NULL);
buf = odb_read_object_peeled(r->objects, oid, OBJ_TREE, &size, NULL);
if (!buf)
die(_("unable to read tree (%s)"), oid_to_hex(oid));
}
@@ -611,7 +611,7 @@ int get_tree_entry(struct repository *r,
unsigned long size;
struct object_id root;
tree = read_object_with_reference(r, tree_oid, OBJ_TREE, &size, &root);
tree = odb_read_object_peeled(r->objects, tree_oid, OBJ_TREE, &size, &root);
if (!tree)
return -1;
@@ -681,10 +681,8 @@ enum get_oid_result get_tree_entry_follow_symlinks(struct repository *r,
void *tree;
struct object_id root;
unsigned long size;
tree = read_object_with_reference(r,
&current_tree_oid,
OBJ_TREE, &size,
&root);
tree = odb_read_object_peeled(r->objects, &current_tree_oid,
OBJ_TREE, &size, &root);
if (!tree)
goto done;