aboutsummaryrefslogtreecommitdiff
path: root/packfile.h
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2025-11-23 19:59:36 +0100
committerJunio C Hamano <gitster@pobox.com>2025-11-23 12:56:45 -0800
commit385e18810f10ec0ce0a266d25da4e1878c8ce15a (patch)
tree6d817f18b5c22197e883df29998ded0f8cfe3db9 /packfile.h
parenteb5abbb4e6a8c06f5c6275bbb541bf7d736171c5 (diff)
downloadgit-385e18810f10ec0ce0a266d25da4e1878c8ce15a.tar.xz
packfile: introduce function to read object info from a store
Extract the logic to read object info for a packed object from `do_oid_object_into_extended()` into a standalone function that operates on the packfile store. This function will be used in a subsequent commit. Note that this change allows us to make `find_pack_entry()` an internal implementation detail. As a consequence though we have to move around `packfile_store_freshen_object()` so that it is defined after that function. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'packfile.h')
-rw-r--r--packfile.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/packfile.h b/packfile.h
index 58fcc88e20..0a98bddd81 100644
--- a/packfile.h
+++ b/packfile.h
@@ -145,6 +145,17 @@ void packfile_store_add_pack(struct packfile_store *store,
for (p = packfile_store_get_packs(repo->objects->packfiles); p; p = p->next)
/*
+ * Try to read the object identified by its ID from the object store and
+ * populate the object info with its data. Returns 1 in case the object was
+ * not found, 0 if it was and read successfully, and a negative error code in
+ * case the object was corrupted.
+ */
+int packfile_store_read_object_info(struct packfile_store *store,
+ const struct object_id *oid,
+ struct object_info *oi,
+ unsigned flags);
+
+/*
* Get all packs managed by the given store, including packfiles that are
* referenced by multi-pack indices.
*/
@@ -357,7 +368,6 @@ const struct packed_git *has_packed_and_bad(struct repository *, const struct ob
* Iff a pack file in the given repository contains the object named by sha1,
* return true and store its location to e.
*/
-int find_pack_entry(struct repository *r, const struct object_id *oid, struct pack_entry *e);
int find_kept_pack_entry(struct repository *r, const struct object_id *oid, unsigned flags, struct pack_entry *e);
int has_object_pack(struct repository *r, const struct object_id *oid);