aboutsummaryrefslogtreecommitdiffstats
path: root/odb.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2025-07-01 14:22:29 +0200
committerJunio C Hamano <gitster@pobox.com>2025-07-01 14:46:39 -0700
commit841a03b4046ab81276743b4d7e727b1658f805da (patch)
tree326a295d6e22f5c1d3dc8d8b46e74b33c7302d17 /odb.c
parent08218b8cd4b54468bbb7cd09454a630ca4209d1a (diff)
downloadgit-841a03b4046ab81276743b4d7e727b1658f805da.tar.gz
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>
Diffstat (limited to 'odb.c')
-rw-r--r--odb.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/odb.c b/odb.c
index 217903d7b1..1f48a0448e 100644
--- a/odb.c
+++ b/odb.c
@@ -905,11 +905,11 @@ void *odb_read_object(struct object_database *odb,
return data;
}
-void *read_object_with_reference(struct repository *r,
- const struct object_id *oid,
- enum object_type required_type,
- unsigned long *size,
- struct object_id *actual_oid_return)
+void *odb_read_object_peeled(struct object_database *odb,
+ const struct object_id *oid,
+ enum object_type required_type,
+ unsigned long *size,
+ struct object_id *actual_oid_return)
{
enum object_type type;
void *buffer;
@@ -921,7 +921,7 @@ void *read_object_with_reference(struct repository *r,
int ref_length = -1;
const char *ref_type = NULL;
- buffer = odb_read_object(r->objects, &actual_oid, &type, &isize);
+ buffer = odb_read_object(odb, &actual_oid, &type, &isize);
if (!buffer)
return NULL;
if (type == required_type) {
@@ -941,9 +941,10 @@ void *read_object_with_reference(struct repository *r,
}
ref_length = strlen(ref_type);
- if (ref_length + r->hash_algo->hexsz > isize ||
+ if (ref_length + odb->repo->hash_algo->hexsz > isize ||
memcmp(buffer, ref_type, ref_length) ||
- get_oid_hex_algop((char *) buffer + ref_length, &actual_oid, r->hash_algo)) {
+ get_oid_hex_algop((char *) buffer + ref_length, &actual_oid,
+ odb->repo->hash_algo)) {
free(buffer);
return NULL;
}