aboutsummaryrefslogtreecommitdiff
path: root/packfile.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2026-01-09 09:33:16 +0100
committerJunio C Hamano <gitster@pobox.com>2026-01-09 06:40:07 -0800
commit6acefa0d2ca0fd95461b19026917d09210032b3d (patch)
treebaeb23aa6e720ce0669d85966bc1deefc1035874 /packfile.c
parent8384cbcb4c737c6d1c6becb40e439c398e3624b4 (diff)
downloadgit-6acefa0d2ca0fd95461b19026917d09210032b3d.tar.xz
packfile: inline `find_kept_pack_entry()`
The `find_kept_pack_entry()` function is only used in `has_object_kept_pack()`, which is only a trivial wrapper itself. Inline the latter into the former. Furthermore, reorder the code so that we can drop the declaration of the function in "packfile.h". This allows us to make the function file-local. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'packfile.c')
-rw-r--r--packfile.c28
1 files changed, 10 insertions, 18 deletions
diff --git a/packfile.c b/packfile.c
index 23d8f7cb93..3bce1b150d 100644
--- a/packfile.c
+++ b/packfile.c
@@ -2215,12 +2215,17 @@ struct packed_git **packfile_store_get_kept_pack_cache(struct packfile_store *st
return store->kept_cache.packs;
}
-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)
+{
+ struct pack_entry e;
+ return find_pack_entry(r, oid, &e);
+}
+
+int has_object_kept_pack(struct repository *r, const struct object_id *oid,
+ unsigned flags)
{
struct odb_source *source;
+ struct pack_entry e;
for (source = r->objects->sources; source; source = source->next) {
struct packed_git **cache;
@@ -2229,7 +2234,7 @@ int find_kept_pack_entry(struct repository *r,
for (; *cache; cache++) {
struct packed_git *p = *cache;
- if (fill_pack_entry(oid, e, p))
+ if (fill_pack_entry(oid, &e, p))
return 1;
}
}
@@ -2237,19 +2242,6 @@ int find_kept_pack_entry(struct repository *r,
return 0;
}
-int has_object_pack(struct repository *r, const struct object_id *oid)
-{
- struct pack_entry e;
- return find_pack_entry(r, oid, &e);
-}
-
-int has_object_kept_pack(struct repository *r, const struct object_id *oid,
- unsigned flags)
-{
- struct pack_entry e;
- return find_kept_pack_entry(r, oid, flags, &e);
-}
-
int for_each_object_in_pack(struct packed_git *p,
each_packed_object_fn cb, void *data,
enum for_each_object_flags flags)