CALLOC_ARRAY(files, 1);
odb_source_init(&files->base, odb, ODB_SOURCE_FILES, path, local);
files->loose = odb_source_loose_new(odb, path, local);
- files->packed = odb_source_packed_new(&files->base);
+ files->packed = odb_source_packed_new(files);
files->base.free = odb_source_files_free;
files->base.close = odb_source_files_close;
#include "git-compat-util.h"
#include "odb/source-packed.h"
-struct odb_source_packed *odb_source_packed_new(struct odb_source *source)
+struct odb_source_packed *odb_source_packed_new(struct odb_source_files *parent)
{
struct odb_source_packed *store;
CALLOC_ARRAY(store, 1);
- store->source = source;
+ store->files = parent;
strmap_init(&store->packs_by_path);
return store;
}
* A store that manages packfiles for a given object database.
*/
struct odb_source_packed {
- struct odb_source *source;
+ struct odb_source_files *files;
/*
* The list of packfiles in the order in which they have been most
* Allocate and initialize a new empty packfile store for the given object
* database source.
*/
-struct odb_source_packed *odb_source_packed_new(struct odb_source *source);
+struct odb_source_packed *odb_source_packed_new(struct odb_source_files *parent);
#endif
p = strmap_get(&store->packs_by_path, key.buf);
if (!p) {
- p = add_packed_git(store->source->odb->repo, idx_path,
+ p = add_packed_git(store->files->base.odb->repo, idx_path,
strlen(idx_path), local);
if (p)
packfile_store_add_pack(store, p);
if (store->initialized)
return;
- prepare_multi_pack_index_one(store->source);
- prepare_packed_git_one(store->source);
+ prepare_multi_pack_index_one(&store->files->base);
+ prepare_packed_git_one(&store->files->base);
sort_packs(&store->packs.head, sort_pack);
for (struct packfile_list_entry *e = store->packs.head; e; e = e->next)
unsigned long count = 0;
int ret;
- m = get_multi_pack_index(store->source);
+ m = get_multi_pack_index(&store->files->base);
if (m)
count += m->num_objects + m->num_objects_in_base;
store->skip_mru_updates = true;
- m = get_multi_pack_index(store->source);
+ m = get_multi_pack_index(&store->files->base);
if (m) {
ret = for_each_prefixed_object_in_midx(store, m, opts, data);
if (ret)
struct packfile_list_entry *e;
struct multi_pack_index *m;
- m = get_multi_pack_index(store->source);
+ m = get_multi_pack_index(&store->files->base);
if (m)
find_abbrev_len_for_midx(m, oid, min_len, &min_len);