aboutsummaryrefslogtreecommitdiffstats
path: root/odb.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2025-09-23 12:17:01 +0200
committerJunio C Hamano <gitster@pobox.com>2025-09-24 11:53:48 -0700
commit535b7a667a94d5882add829e30e20b6dfa076640 (patch)
tree040facee4b2e891804f391b0f33b42bcfb1e384d /odb.c
parentb7983adb5180c62586753754ae22a24ce8f7a04c (diff)
downloadgit-535b7a667a94d5882add829e30e20b6dfa076640.tar.gz
odb: move list of packfiles into `struct packfile_store`
The object database tracks the list of packfiles it currently knows about. With the introduction of the `struct packfile_store` we have a better place to host this list though. Move the list accordingly. Extract the logic from `odb_clear()` that knows to close all such packfiles and move it into the new subsystem, as well. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'odb.c')
-rw-r--r--odb.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/odb.c b/odb.c
index a2289ea97d..7201d01406 100644
--- a/odb.c
+++ b/odb.c
@@ -1038,16 +1038,8 @@ void odb_clear(struct object_database *o)
INIT_LIST_HEAD(&o->packed_git_mru);
close_object_store(o);
-
- /*
- * `close_object_store()` only closes the packfiles, but doesn't free
- * them. We thus have to do this manually.
- */
- for (struct packed_git *p = o->packed_git, *next; p; p = next) {
- next = p->next;
- free(p);
- }
- o->packed_git = NULL;
+ packfile_store_free(o->packfiles);
+ o->packfiles = NULL;
hashmap_clear(&o->pack_map);
string_list_clear(&o->submodule_source_paths, 0);