diff options
| author | Patrick Steinhardt <ps@pks.im> | 2025-07-01 14:22:26 +0200 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-07-01 14:46:38 -0700 |
| commit | d4ff88aee3967e5d1ef1237cd9b8792b7cdb304c (patch) | |
| tree | 0951b639fd3ead92506db2216efb384e12bd6cc0 /odb.h | |
| parent | odb: rename `oid_object_info()` (diff) | |
| download | git-d4ff88aee3967e5d1ef1237cd9b8792b7cdb304c.tar.gz git-d4ff88aee3967e5d1ef1237cd9b8792b7cdb304c.zip | |
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 <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'odb.h')
| -rw-r--r-- | odb.h | 29 |
1 files changed, 23 insertions, 6 deletions
@@ -140,7 +140,7 @@ struct object_database { /* * 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). */ @@ -260,10 +260,19 @@ void odb_add_to_alternates_file(struct object_database *odb, void odb_add_to_alternates_memory(struct object_database *odb, const char *dir); -void *repo_read_object_file(struct repository *r, - const struct object_id *oid, - enum object_type *type, - unsigned long *size); +/* + * Read an object from the database. Returns the object data and assigns object + * type and size to the `type` and `size` pointers, if these pointers are + * non-NULL. Returns a `NULL` pointer in case the object does not exist. + * + * 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 *odb_read_object(struct object_database *odb, + const struct object_id *oid, + enum object_type *type, + unsigned long *size); /* * Add an object file to the in-memory object store, without writing it @@ -371,7 +380,7 @@ void odb_assert_oid_type(struct object_database *odb, /* * Enabling the object read lock allows multiple threads to safely call the - * following functions in parallel: repo_read_object_file(), + * following functions in parallel: odb_read_object(), * read_object_with_reference(), odb_read_object_info() and odb(). * * obj_read_lock() and obj_read_unlock() may also be used to protect other @@ -446,4 +455,12 @@ static inline int oid_object_info(struct repository *r, return odb_read_object_info(r->objects, oid, sizep); } +static inline void *repo_read_object_file(struct repository *r, + const struct object_id *oid, + enum object_type *type, + unsigned long *size) +{ + return odb_read_object(r->objects, oid, type, size); +} + #endif /* ODB_H */ |
