struct multi_pack_index *get_multi_pack_index(struct odb_source *source)
{
packfile_store_prepare(source->packfiles);
- return source->midx;
+ return source->packfiles->midx;
}
static struct multi_pack_index *load_multi_pack_index_one(struct odb_source *source,
if (!r->settings.core_multi_pack_index)
return 0;
- if (source->midx)
+ if (source->packfiles->midx)
return 1;
- source->midx = load_multi_pack_index(source);
+ source->packfiles->midx = load_multi_pack_index(source);
- return !!source->midx;
+ return !!source->packfiles->midx;
}
int midx_checksum_valid(struct multi_pack_index *m)
struct odb_source *source;
for (source = r->objects->sources; source; source = source->next) {
- if (source->midx)
- close_midx(source->midx);
- source->midx = NULL;
+ if (source->packfiles->midx)
+ close_midx(source->packfiles->midx);
+ source->packfiles->midx = NULL;
}
}
void odb_close(struct object_database *o)
{
struct odb_source *source;
-
- for (source = o->sources; source; source = source->next) {
+ for (source = o->sources; source; source = source->next)
packfile_store_close(source->packfiles);
- if (source->midx)
- close_midx(source->midx);
- source->midx = NULL;
- }
-
close_commit_graph(o);
}
/* Should only be accessed directly by packfile.c and midx.c. */
struct packfile_store *packfiles;
- /*
- * private data
- *
- * should only be accessed directly by packfile.c and midx.c
- */
- struct multi_pack_index *midx;
-
/*
* Figure out whether this is the local source of the owning
* repository, which would typically be its ".git/objects" directory.
size_t base_len = full_name_len;
if (strip_suffix_mem(full_name, &base_len, ".idx") &&
- !(data->source->midx && midx_contains_pack(data->source->midx, file_name))) {
+ !(data->source->packfiles->midx &&
+ midx_contains_pack(data->source->packfiles->midx, file_name))) {
char *trimmed_path = xstrndup(full_name, full_name_len);
packfile_store_load_pack(data->source->packfiles,
trimmed_path, data->source->local);
{
packfile_store_prepare(store);
- if (store->source->midx) {
- struct multi_pack_index *m = store->source->midx;
+ if (store->midx) {
+ struct multi_pack_index *m = store->midx;
for (uint32_t i = 0; i < m->num_packs + m->num_packs_in_base; i++)
prepare_midx_pack(m, i);
}
struct packfile_list_entry *l;
packfile_store_prepare(store);
- if (store->source->midx && fill_midx_entry(store->source->midx, oid, e))
+ if (store->midx && fill_midx_entry(store->midx, oid, e))
return 1;
for (l = store->packs.head; l; l = l->next) {
BUG("want to close pack marked 'do-not-close'");
close_pack(e->pack);
}
+ if (store->midx)
+ close_midx(store->midx);
+ store->midx = NULL;
}
struct odb_packed_read_stream {
unsigned flags;
} kept_cache;
+ /* The multi-pack index that belongs to this specific packfile store. */
+ struct multi_pack_index *midx;
+
/*
* A map of packfile names to packed_git structs for tracking which
* packs have been loaded already.