return source->loose->cache;
}
-void odb_clear_loose_cache(struct odb_source *source)
+static void odb_source_loose_clear_cache(struct odb_source_loose *loose)
{
- oidtree_clear(source->loose->cache);
- FREE_AND_NULL(source->loose->cache);
- memset(&source->loose->subdir_seen, 0,
- sizeof(source->loose->subdir_seen));
+ oidtree_clear(loose->cache);
+ FREE_AND_NULL(loose->cache);
+ memset(&loose->subdir_seen, 0,
+ sizeof(loose->subdir_seen));
+}
+
+void odb_source_loose_reprepare(struct odb_source *source)
+{
+ odb_source_loose_clear_cache(source->loose);
}
static int check_stream_oid(git_zstream *stream,
{
if (!loose)
return;
- odb_clear_loose_cache(loose->source);
+ odb_source_loose_clear_cache(loose);
free(loose);
}
struct odb_source_loose *odb_source_loose_new(struct odb_source *source);
void odb_source_loose_free(struct odb_source_loose *loose);
+/* Reprepare the loose source by emptying the loose object cache. */
+void odb_source_loose_reprepare(struct odb_source *source);
+
/*
* Populate and return the loose object cache array corresponding to the
* given object ID.
struct oidtree *odb_source_loose_cache(struct odb_source *source,
const struct object_id *oid);
-/* Empty the loose object cache for the specified object directory. */
-void odb_clear_loose_cache(struct odb_source *source);
-
/*
* Put in `buf` the name of the file in the local object database that
* would be used to store a loose object with the specified oid.
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;