From d4ff88aee3967e5d1ef1237cd9b8792b7cdb304c Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Tue, 1 Jul 2025 14:22:26 +0200 Subject: odb: rename `repo_read_object_file()` Rename `repo_read_object_file()` to `odb_read_object()` to match other functions related to the object database and our modern coding guidelines. Introduce a compatibility wrapper so that any in-flight topics will continue to compile. Signed-off-by: Patrick Steinhardt Signed-off-by: Junio C Hamano --- odb.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'odb.c') diff --git a/odb.c b/odb.c index 40eacdfe2d..5419d5dff6 100644 --- a/odb.c +++ b/odb.c @@ -30,7 +30,7 @@ KHASH_INIT(odb_path_map, const char * /* key: odb_path */, /* * This is meant to hold a *small* number of objects that you would - * want repo_read_object_file() to be able to return, but yet you do not want + * want odb_read_object() to be able to return, but yet you do not want * to write them into the object store (e.g. a browse-only * application). */ @@ -887,15 +887,10 @@ int pretend_object_file(struct repository *repo, return 0; } -/* - * This function dies on corrupt objects; the callers who want to - * deal with them should arrange to call odb_read_object_info_extended() and give - * error messages themselves. - */ -void *repo_read_object_file(struct repository *r, - const struct object_id *oid, - enum object_type *type, - unsigned long *size) +void *odb_read_object(struct object_database *odb, + const struct object_id *oid, + enum object_type *type, + unsigned long *size) { struct object_info oi = OBJECT_INFO_INIT; unsigned flags = OBJECT_INFO_DIE_IF_CORRUPT | OBJECT_INFO_LOOKUP_REPLACE; @@ -904,7 +899,7 @@ void *repo_read_object_file(struct repository *r, oi.typep = type; oi.sizep = size; oi.contentp = &data; - if (odb_read_object_info_extended(r->objects, oid, &oi, flags)) + if (odb_read_object_info_extended(odb, oid, &oi, flags)) return NULL; return data; @@ -926,7 +921,7 @@ void *read_object_with_reference(struct repository *r, int ref_length = -1; const char *ref_type = NULL; - buffer = repo_read_object_file(r, &actual_oid, &type, &isize); + buffer = odb_read_object(r->objects, &actual_oid, &type, &isize); if (!buffer) return NULL; if (type == required_type) { -- cgit v1.2.3