aboutsummaryrefslogtreecommitdiffstats
path: root/packfile.h
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2025-09-23 12:17:03 +0200
committerJunio C Hamano <gitster@pobox.com>2025-09-24 11:53:49 -0700
commit14aaf5c9d889a4988ffc64b39fe38bd19b930a50 (patch)
treec89d06e15bbda04c6f1573389d3bc2aeb3e2f43a /packfile.h
parentodb: move initialization bit into `struct packfile_store` (diff)
downloadgit-14aaf5c9d889a4988ffc64b39fe38bd19b930a50.tar.gz
git-14aaf5c9d889a4988ffc64b39fe38bd19b930a50.zip
odb: move packfile map into `struct packfile_store`
The object database tracks a map of packfiles by their respective paths, which is used to figure out whether a given packfile has already been loaded. With the introduction of the `struct packfile_store` we have a better place to host this list though. Move the map accordingly. `pack_map_entry_cmp()` isn't used anywhere but in "packfile.c" anymore after this change, so we convert it to a static function, as well. Note that we also drop the `inline` hint: the function is used as a callback function exclusively, and callbacks cannot be inlined. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to '')
-rw-r--r--packfile.h20
1 files changed, 6 insertions, 14 deletions
diff --git a/packfile.h b/packfile.h
index cf81091175..9bbef51164 100644
--- a/packfile.h
+++ b/packfile.h
@@ -65,6 +65,12 @@ struct packfile_store {
struct packed_git *packs;
/*
+ * A map of packfile names to packed_git structs for tracking which
+ * packs have been loaded already.
+ */
+ struct hashmap map;
+
+ /*
* Whether packfiles have already been populated with this store's
* packs.
*/
@@ -89,20 +95,6 @@ void packfile_store_free(struct packfile_store *store);
*/
void packfile_store_close(struct packfile_store *store);
-static inline int pack_map_entry_cmp(const void *cmp_data UNUSED,
- const struct hashmap_entry *entry,
- const struct hashmap_entry *entry2,
- const void *keydata)
-{
- const char *key = keydata;
- const struct packed_git *pg1, *pg2;
-
- pg1 = container_of(entry, const struct packed_git, packmap_ent);
- pg2 = container_of(entry2, const struct packed_git, packmap_ent);
-
- return strcmp(pg1->pack_name, key ? key : pg2->pack_name);
-}
-
struct pack_window {
struct pack_window *next;
unsigned char *base;