return -1;
}
-static void rearrange_packed_git(struct repository *r)
-{
- sort_packs(&r->objects->packfiles->packs, sort_pack);
-}
-
-static void prepare_packed_git_mru(struct repository *r)
+static void packfile_store_prepare_mru(struct packfile_store *store)
{
struct packed_git *p;
- INIT_LIST_HEAD(&r->objects->packfiles->mru);
+ INIT_LIST_HEAD(&store->mru);
- for (p = r->objects->packfiles->packs; p; p = p->next)
- list_add_tail(&p->mru, &r->objects->packfiles->mru);
+ for (p = store->packs; p; p = p->next)
+ list_add_tail(&p->mru, &store->mru);
}
-static void prepare_packed_git(struct repository *r)
+static void packfile_store_prepare(struct packfile_store *store)
{
struct odb_source *source;
- if (r->objects->packfiles->initialized)
+ if (store->initialized)
return;
- odb_prepare_alternates(r->objects);
- for (source = r->objects->sources; source; source = source->next) {
+ odb_prepare_alternates(store->odb);
+ for (source = store->odb->sources; source; source = source->next) {
prepare_multi_pack_index_one(source);
prepare_packed_git_one(source);
}
- rearrange_packed_git(r);
+ sort_packs(&store->packs, sort_pack);
- prepare_packed_git_mru(r);
- r->objects->packfiles->initialized = true;
+ packfile_store_prepare_mru(store);
+ store->initialized = true;
}
void reprepare_packed_git(struct repository *r)
r->objects->approximate_object_count_valid = 0;
r->objects->packfiles->initialized = false;
- prepare_packed_git(r);
+ packfile_store_prepare(r->objects->packfiles);
obj_read_unlock();
}
struct packed_git *get_packed_git(struct repository *r)
{
- prepare_packed_git(r);
+ packfile_store_prepare(r->objects->packfiles);
return r->objects->packfiles->packs;
}
struct multi_pack_index *get_multi_pack_index(struct odb_source *source)
{
- prepare_packed_git(source->odb->repo);
+ packfile_store_prepare(source->odb->packfiles);
return source->midx;
}
struct packed_git *get_all_packs(struct repository *r)
{
- prepare_packed_git(r);
+ packfile_store_prepare(r->objects->packfiles);
for (struct odb_source *source = r->objects->sources; source; source = source->next) {
struct multi_pack_index *m = source->midx;
struct list_head *get_packed_git_mru(struct repository *r)
{
- prepare_packed_git(r);
+ packfile_store_prepare(r->objects->packfiles);
return &r->objects->packfiles->mru;
}
unsigned long count = 0;
struct packed_git *p;
- prepare_packed_git(r);
+ packfile_store_prepare(r->objects->packfiles);
for (source = r->objects->sources; source; source = source->next) {
struct multi_pack_index *m = get_multi_pack_index(source);
{
struct list_head *pos;
- prepare_packed_git(r);
+ packfile_store_prepare(r->objects->packfiles);
for (struct odb_source *source = r->objects->sources; source; source = source->next)
if (source->midx && fill_midx_entry(source->midx, oid, e))