aboutsummaryrefslogtreecommitdiff
path: root/odb.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2025-11-03 08:42:02 +0100
committerJunio C Hamano <gitster@pobox.com>2025-11-03 12:18:46 -0800
commitbe659c97eae3b68e38b71f0a67067dede23903b5 (patch)
treed1964ece9ec66306ac485214f4bffb2f5e93b1be /odb.c
parent90a93f9dea88532623ef7422dbc21d8dc70a58dd (diff)
downloadgit-be659c97eae3b68e38b71f0a67067dede23903b5.tar.xz
object-file: hide internals when we need to reprepare loose sources
There are two different situations where we have to clear the cache of loose objects: - When freeing the loose object source itself to avoid memory leaks. - When repreparing the loose object source so that any potentially- stale data is getting evicted from the cache. The former is already handled by `odb_source_loose_free()`. But the latter case is still done manually by in `odb_reprepare()`, so we are leaking internals into that code. Introduce a new `odb_source_loose_reprepare()` function as an equivalent to `packfile_store_prepare()` to hide these implementation details. Furthermore, while at it, rename the function `odb_clear_loose_cache()` to `odb_source_loose_clear()`. 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.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/odb.c b/odb.c
index 87d84688c6..b3e8d4a49c 100644
--- a/odb.c
+++ b/odb.c
@@ -1071,7 +1071,7 @@ void odb_reprepare(struct object_database *o)
odb_prepare_alternates(o);
for (source = o->sources; source; source = source->next)
- odb_clear_loose_cache(source);
+ odb_source_loose_reprepare(source);
o->approximate_object_count_valid = 0;