]> git.ipfire.org Git - thirdparty/git.git/commitdiff
packfile: refactor `get_all_packs()` to work on packfile store
authorPatrick Steinhardt <ps@pks.im>
Tue, 23 Sep 2025 10:17:13 +0000 (12:17 +0200)
committerJunio C Hamano <gitster@pobox.com>
Wed, 24 Sep 2025 18:53:51 +0000 (11:53 -0700)
The `get_all_packs()` function prepares the packfile store and then
returns its packfiles. Refactor it to accept a packfile store instead of
a repository to clarify its scope.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
18 files changed:
builtin/cat-file.c
builtin/count-objects.c
builtin/fast-import.c
builtin/fsck.c
builtin/gc.c
builtin/pack-objects.c
builtin/pack-redundant.c
builtin/repack.c
connected.c
http-backend.c
http.c
pack-bitmap.c
pack-objects.c
packfile.c
packfile.h
server-info.c
t/helper/test-find-pack.c
t/helper/test-pack-mtimes.c

index fce0b06451c5cdff3036797ab506dc30498bd68a..ee6715fa523ce6094dd65a83b2f8b413f3854a87 100644 (file)
@@ -852,9 +852,10 @@ static void batch_each_object(struct batch_options *opt,
 
        if (bitmap && !for_each_bitmapped_object(bitmap, &opt->objects_filter,
                                                 batch_one_object_bitmapped, &payload)) {
+               struct packfile_store *packs = the_repository->objects->packfiles;
                struct packed_git *pack;
 
-               for (pack = get_all_packs(the_repository); pack; pack = pack->next) {
+               for (pack = packfile_store_get_all_packs(packs); pack; pack = pack->next) {
                        if (bitmap_index_contains_pack(bitmap, pack) ||
                            open_pack_index(pack))
                                continue;
index a61d3b46aac6273c3a7ad2c9ac5e5855c3c8bd22..f2f407c2a7818334d9fce189228a76aac0c245f7 100644 (file)
@@ -122,6 +122,7 @@ int cmd_count_objects(int argc,
                                      count_loose, count_cruft, NULL, NULL);
 
        if (verbose) {
+               struct packfile_store *packs = the_repository->objects->packfiles;
                struct packed_git *p;
                unsigned long num_pack = 0;
                off_t size_pack = 0;
@@ -129,7 +130,7 @@ int cmd_count_objects(int argc,
                struct strbuf pack_buf = STRBUF_INIT;
                struct strbuf garbage_buf = STRBUF_INIT;
 
-               for (p = get_all_packs(the_repository); p; p = p->next) {
+               for (p = packfile_store_get_all_packs(packs); p; p = p->next) {
                        if (!p->pack_local)
                                continue;
                        if (open_pack_index(p))
index a26e79689d55b86709abbe4636cd54008be43a29..b1d5549815ac66b773ad4c1592b34f9a8d590ee2 100644 (file)
@@ -952,6 +952,7 @@ static int store_object(
        struct object_id *oidout,
        uintmax_t mark)
 {
+       struct packfile_store *packs = the_repository->objects->packfiles;
        void *out, *delta;
        struct object_entry *e;
        unsigned char hdr[96];
@@ -975,7 +976,7 @@ static int store_object(
        if (e->idx.offset) {
                duplicate_count_by_type[type]++;
                return 1;
-       } else if (find_oid_pack(&oid, get_all_packs(the_repository))) {
+       } else if (find_oid_pack(&oid, packfile_store_get_all_packs(packs))) {
                e->type = type;
                e->pack_id = MAX_PACK_ID;
                e->idx.offset = 1; /* just not zero! */
@@ -1092,6 +1093,7 @@ static void truncate_pack(struct hashfile_checkpoint *checkpoint)
 
 static void stream_blob(uintmax_t len, struct object_id *oidout, uintmax_t mark)
 {
+       struct packfile_store *packs = the_repository->objects->packfiles;
        size_t in_sz = 64 * 1024, out_sz = 64 * 1024;
        unsigned char *in_buf = xmalloc(in_sz);
        unsigned char *out_buf = xmalloc(out_sz);
@@ -1175,7 +1177,7 @@ static void stream_blob(uintmax_t len, struct object_id *oidout, uintmax_t mark)
                duplicate_count_by_type[OBJ_BLOB]++;
                truncate_pack(&checkpoint);
 
-       } else if (find_oid_pack(&oid, get_all_packs(the_repository))) {
+       } else if (find_oid_pack(&oid, packfile_store_get_all_packs(packs))) {
                e->type = OBJ_BLOB;
                e->pack_id = MAX_PACK_ID;
                e->idx.offset = 1; /* just not zero! */
index d2eb9d4fbe922bc6ada11573ef61c1731b97e162..8ee95e0d67cf374b9814c92558ce969796300a7b 100644 (file)
@@ -867,19 +867,20 @@ static int mark_packed_for_connectivity(const struct object_id *oid,
 
 static int check_pack_rev_indexes(struct repository *r, int show_progress)
 {
+       struct packfile_store *packs = r->objects->packfiles;
        struct progress *progress = NULL;
        uint32_t pack_count = 0;
        int res = 0;
 
        if (show_progress) {
-               for (struct packed_git *p = get_all_packs(r); p; p = p->next)
+               for (struct packed_git *p = packfile_store_get_all_packs(packs); p; p = p->next)
                        pack_count++;
                progress = start_delayed_progress(the_repository,
                                                  "Verifying reverse pack-indexes", pack_count);
                pack_count = 0;
        }
 
-       for (struct packed_git *p = get_all_packs(r); p; p = p->next) {
+       for (struct packed_git *p = packfile_store_get_all_packs(packs); p; p = p->next) {
                int load_error = load_pack_revindex_from_disk(p);
 
                if (load_error < 0) {
@@ -999,6 +1000,8 @@ int cmd_fsck(int argc,
                for_each_packed_object(the_repository,
                                       mark_packed_for_connectivity, NULL, 0);
        } else {
+               struct packfile_store *packs = the_repository->objects->packfiles;
+
                odb_prepare_alternates(the_repository->objects);
                for (source = the_repository->objects->sources; source; source = source->next)
                        fsck_source(source);
@@ -1009,7 +1012,7 @@ int cmd_fsck(int argc,
                        struct progress *progress = NULL;
 
                        if (show_progress) {
-                               for (p = get_all_packs(the_repository); p;
+                               for (p = packfile_store_get_all_packs(packs); p;
                                     p = p->next) {
                                        if (open_pack_index(p))
                                                continue;
@@ -1019,7 +1022,7 @@ int cmd_fsck(int argc,
                                progress = start_progress(the_repository,
                                                          _("Checking objects"), total);
                        }
-                       for (p = get_all_packs(the_repository); p;
+                       for (p = packfile_store_get_all_packs(packs); p;
                             p = p->next) {
                                /* verify gives error messages itself */
                                if (verify_pack(the_repository,
index ec6735a540ad1b4a2273e26e121f1a3ae6c65941..e19e13d9788076cf05029561a4fdcfea9f1fc095 100644 (file)
@@ -487,9 +487,10 @@ static int too_many_loose_objects(struct gc_config *cfg)
 static struct packed_git *find_base_packs(struct string_list *packs,
                                          unsigned long limit)
 {
+       struct packfile_store *packfiles = the_repository->objects->packfiles;
        struct packed_git *p, *base = NULL;
 
-       for (p = get_all_packs(the_repository); p; p = p->next) {
+       for (p = packfile_store_get_all_packs(packfiles); p; p = p->next) {
                if (!p->pack_local || p->is_cruft)
                        continue;
                if (limit) {
@@ -508,13 +509,14 @@ static struct packed_git *find_base_packs(struct string_list *packs,
 
 static int too_many_packs(struct gc_config *cfg)
 {
+       struct packfile_store *packs = the_repository->objects->packfiles;
        struct packed_git *p;
        int cnt;
 
        if (cfg->gc_auto_pack_limit <= 0)
                return 0;
 
-       for (cnt = 0, p = get_all_packs(the_repository); p; p = p->next) {
+       for (cnt = 0, p = packfile_store_get_all_packs(packs); p; p = p->next) {
                if (!p->pack_local)
                        continue;
                if (p->pack_keep)
@@ -1492,7 +1494,7 @@ static off_t get_auto_pack_size(void)
        struct repository *r = the_repository;
 
        odb_reprepare(r->objects);
-       for (p = get_all_packs(r); p; p = p->next) {
+       for (p = packfile_store_get_all_packs(r->objects->packfiles); p; p = p->next) {
                if (p->pack_size > max_size) {
                        second_largest_size = max_size;
                        max_size = p->pack_size;
index 1494afcf3dffe6aec8ac4a622dce13ecf4f88eb9..de351b757ae4462f73b8162d1b5a2fafa1321c81 100644 (file)
@@ -3831,6 +3831,7 @@ static int pack_mtime_cmp(const void *_a, const void *_b)
 
 static void read_packs_list_from_stdin(struct rev_info *revs)
 {
+       struct packfile_store *packs = the_repository->objects->packfiles;
        struct strbuf buf = STRBUF_INIT;
        struct string_list include_packs = STRING_LIST_INIT_DUP;
        struct string_list exclude_packs = STRING_LIST_INIT_DUP;
@@ -3855,7 +3856,7 @@ static void read_packs_list_from_stdin(struct rev_info *revs)
        string_list_sort(&exclude_packs);
        string_list_remove_duplicates(&exclude_packs, 0);
 
-       for (p = get_all_packs(the_repository); p; p = p->next) {
+       for (p = packfile_store_get_all_packs(packs); p; p = p->next) {
                const char *pack_name = pack_basename(p);
 
                if ((item = string_list_lookup(&include_packs, pack_name)))
@@ -4076,6 +4077,7 @@ static void enumerate_cruft_objects(void)
 
 static void enumerate_and_traverse_cruft_objects(struct string_list *fresh_packs)
 {
+       struct packfile_store *packs = the_repository->objects->packfiles;
        struct packed_git *p;
        struct rev_info revs;
        int ret;
@@ -4105,7 +4107,7 @@ static void enumerate_and_traverse_cruft_objects(struct string_list *fresh_packs
         * Re-mark only the fresh packs as kept so that objects in
         * unknown packs do not halt the reachability traversal early.
         */
-       for (p = get_all_packs(the_repository); p; p = p->next)
+       for (p = packfile_store_get_all_packs(packs); p; p = p->next)
                p->pack_keep_in_core = 0;
        mark_pack_kept_in_core(fresh_packs, 1);
 
@@ -4122,6 +4124,7 @@ static void enumerate_and_traverse_cruft_objects(struct string_list *fresh_packs
 
 static void read_cruft_objects(void)
 {
+       struct packfile_store *packs = the_repository->objects->packfiles;
        struct strbuf buf = STRBUF_INIT;
        struct string_list discard_packs = STRING_LIST_INIT_DUP;
        struct string_list fresh_packs = STRING_LIST_INIT_DUP;
@@ -4142,7 +4145,7 @@ static void read_cruft_objects(void)
        string_list_sort(&discard_packs);
        string_list_sort(&fresh_packs);
 
-       for (p = get_all_packs(the_repository); p; p = p->next) {
+       for (p = packfile_store_get_all_packs(packs); p; p = p->next) {
                const char *pack_name = pack_basename(p);
                struct string_list_item *item;
 
@@ -4390,11 +4393,12 @@ static void add_unreachable_loose_objects(struct rev_info *revs)
 
 static int has_sha1_pack_kept_or_nonlocal(const struct object_id *oid)
 {
+       struct packfile_store *packs = the_repository->objects->packfiles;
        static struct packed_git *last_found = (void *)1;
        struct packed_git *p;
 
        p = (last_found != (void *)1) ? last_found :
-                                       get_all_packs(the_repository);
+                                       packfile_store_get_all_packs(packs);
 
        while (p) {
                if ((!p->pack_local || p->pack_keep ||
@@ -4404,7 +4408,7 @@ static int has_sha1_pack_kept_or_nonlocal(const struct object_id *oid)
                        return 1;
                }
                if (p == last_found)
-                       p = get_all_packs(the_repository);
+                       p = packfile_store_get_all_packs(packs);
                else
                        p = p->next;
                if (p == last_found)
@@ -4436,12 +4440,13 @@ static int loosened_object_can_be_discarded(const struct object_id *oid,
 
 static void loosen_unused_packed_objects(void)
 {
+       struct packfile_store *packs = the_repository->objects->packfiles;
        struct packed_git *p;
        uint32_t i;
        uint32_t loosened_objects_nr = 0;
        struct object_id oid;
 
-       for (p = get_all_packs(the_repository); p; p = p->next) {
+       for (p = packfile_store_get_all_packs(packs); p; p = p->next) {
                if (!p->pack_local || p->pack_keep || p->pack_keep_in_core)
                        continue;
 
@@ -4742,12 +4747,13 @@ static void get_object_list(struct rev_info *revs, int ac, const char **av)
 
 static void add_extra_kept_packs(const struct string_list *names)
 {
+       struct packfile_store *packs = the_repository->objects->packfiles;
        struct packed_git *p;
 
        if (!names->nr)
                return;
 
-       for (p = get_all_packs(the_repository); p; p = p->next) {
+       for (p = packfile_store_get_all_packs(packs); p; p = p->next) {
                const char *name = basename(p->pack_name);
                int i;
 
@@ -5185,8 +5191,10 @@ int cmd_pack_objects(int argc,
 
        add_extra_kept_packs(&keep_pack_list);
        if (ignore_packed_keep_on_disk) {
+               struct packfile_store *packs = the_repository->objects->packfiles;
                struct packed_git *p;
-               for (p = get_all_packs(the_repository); p; p = p->next)
+
+               for (p = packfile_store_get_all_packs(packs); p; p = p->next)
                        if (p->pack_local && p->pack_keep)
                                break;
                if (!p) /* no keep-able packs found */
@@ -5198,8 +5206,10 @@ int cmd_pack_objects(int argc,
                 * want to unset "local" based on looking at packs, as
                 * it also covers non-local objects
                 */
+               struct packfile_store *packs = the_repository->objects->packfiles;
                struct packed_git *p;
-               for (p = get_all_packs(the_repository); p; p = p->next) {
+
+               for (p = packfile_store_get_all_packs(packs); p; p = p->next) {
                        if (!p->pack_local) {
                                have_non_local_packs = 1;
                                break;
index fe81c293e3af6f6b1db03c8e27b5283af8c7d3fe..dd28171f0a179a156c4e48c82dd444bde5a7995a 100644 (file)
@@ -566,7 +566,8 @@ static struct pack_list * add_pack(struct packed_git *p)
 
 static struct pack_list * add_pack_file(const char *filename)
 {
-       struct packed_git *p = get_all_packs(the_repository);
+       struct packfile_store *packs = the_repository->objects->packfiles;
+       struct packed_git *p = packfile_store_get_all_packs(packs);
 
        if (strlen(filename) < 40)
                die("Bad pack filename: %s", filename);
@@ -581,7 +582,8 @@ static struct pack_list * add_pack_file(const char *filename)
 
 static void load_all(void)
 {
-       struct packed_git *p = get_all_packs(the_repository);
+       struct packfile_store *packs = the_repository->objects->packfiles;
+       struct packed_git *p = packfile_store_get_all_packs(packs);
 
        while (p) {
                add_pack(p);
index 5ff27fc8e29a9b426fbcbdf427a662829ab64116..e8730808c535a96732610d8250a31e5b0ced68a7 100644 (file)
@@ -265,10 +265,11 @@ static void existing_packs_release(struct existing_packs *existing)
 static void collect_pack_filenames(struct existing_packs *existing,
                                   const struct string_list *extra_keep)
 {
+       struct packfile_store *packs = the_repository->objects->packfiles;
        struct packed_git *p;
        struct strbuf buf = STRBUF_INIT;
 
-       for (p = get_all_packs(the_repository); p; p = p->next) {
+       for (p = packfile_store_get_all_packs(packs); p; p = p->next) {
                int i;
                const char *base;
 
@@ -497,10 +498,11 @@ static void init_pack_geometry(struct pack_geometry *geometry,
                               struct existing_packs *existing,
                               const struct pack_objects_args *args)
 {
+       struct packfile_store *packs = the_repository->objects->packfiles;
        struct packed_git *p;
        struct strbuf buf = STRBUF_INIT;
 
-       for (p = get_all_packs(the_repository); p; p = p->next) {
+       for (p = packfile_store_get_all_packs(packs); p; p = p->next) {
                if (args->local && !p->pack_local)
                        /*
                         * When asked to only repack local packfiles we skip
@@ -1137,11 +1139,12 @@ static int write_filtered_pack(const struct pack_objects_args *args,
 static void combine_small_cruft_packs(FILE *in, size_t combine_cruft_below_size,
                                      struct existing_packs *existing)
 {
+       struct packfile_store *packs = the_repository->objects->packfiles;
        struct packed_git *p;
        struct strbuf buf = STRBUF_INIT;
        size_t i;
 
-       for (p = get_all_packs(the_repository); p; p = p->next) {
+       for (p = packfile_store_get_all_packs(packs); p; p = p->next) {
                if (!(p->is_cruft && p->pack_local))
                        continue;
 
index d6e9682fd93ce9f8beb1b1693d31fca40eb0cc1e..b288a18b17c33fcead8b14947dfce38276c3d093 100644 (file)
@@ -74,9 +74,10 @@ int check_connected(oid_iterate_fn fn, void *cb_data,
                 */
                odb_reprepare(the_repository->objects);
                do {
+                       struct packfile_store *packs = the_repository->objects->packfiles;
                        struct packed_git *p;
 
-                       for (p = get_all_packs(the_repository); p; p = p->next) {
+                       for (p = packfile_store_get_all_packs(packs); p; p = p->next) {
                                if (!p->pack_promisor)
                                        continue;
                                if (find_pack_entry_one(oid, p))
index d5dfe762bb51783cf6f81de8cfa79075d26075c3..9084058f1e9f138bda8525ce6db52df24b2fa95e 100644 (file)
@@ -603,18 +603,19 @@ static void get_head(struct strbuf *hdr, char *arg UNUSED)
 static void get_info_packs(struct strbuf *hdr, char *arg UNUSED)
 {
        size_t objdirlen = strlen(repo_get_object_directory(the_repository));
+       struct packfile_store *packs = the_repository->objects->packfiles;
        struct strbuf buf = STRBUF_INIT;
        struct packed_git *p;
        size_t cnt = 0;
 
        select_getanyfile(hdr);
-       for (p = get_all_packs(the_repository); p; p = p->next) {
+       for (p = packfile_store_get_all_packs(packs); p; p = p->next) {
                if (p->pack_local)
                        cnt++;
        }
 
        strbuf_grow(&buf, cnt * 53 + 2);
-       for (p = get_all_packs(the_repository); p; p = p->next) {
+       for (p = packfile_store_get_all_packs(packs); p; p = p->next) {
                if (p->pack_local)
                        strbuf_addf(&buf, "P %s\n", p->pack_name + objdirlen + 6);
        }
diff --git a/http.c b/http.c
index af2120b64c711c1d59518a30bae7b96777ac181a..077e879de9ebabc9fec996e2b9ab2842c7d18c54 100644 (file)
--- a/http.c
+++ b/http.c
@@ -2408,6 +2408,7 @@ static char *fetch_pack_index(unsigned char *hash, const char *base_url)
 static int fetch_and_setup_pack_index(struct packed_git **packs_head,
        unsigned char *sha1, const char *base_url)
 {
+       struct packfile_store *packs = the_repository->objects->packfiles;
        struct packed_git *new_pack, *p;
        char *tmp_idx = NULL;
        int ret;
@@ -2416,7 +2417,7 @@ static int fetch_and_setup_pack_index(struct packed_git **packs_head,
         * If we already have the pack locally, no need to fetch its index or
         * even add it to list; we already have all of its objects.
         */
-       for (p = get_all_packs(the_repository); p; p = p->next) {
+       for (p = packfile_store_get_all_packs(packs); p; p = p->next) {
                if (hasheq(p->hash, sha1, the_repository->hash_algo))
                        return 0;
        }
index 058bdb5d7ded0b46337015bd05f3b9ca7ebf2ab5..ac71035d7715f7f9a86468fd2754bb5283a80e41 100644 (file)
@@ -664,7 +664,7 @@ static int open_pack_bitmap(struct repository *r,
        struct packed_git *p;
        int ret = -1;
 
-       for (p = get_all_packs(r); p; p = p->next) {
+       for (p = packfile_store_get_all_packs(r->objects->packfiles); p; p = p->next) {
                if (open_pack_bitmap_1(bitmap_git, p) == 0) {
                        ret = 0;
                        /*
@@ -3362,7 +3362,7 @@ int verify_bitmap_files(struct repository *r)
                free(midx_bitmap_name);
        }
 
-       for (struct packed_git *p = get_all_packs(r);
+       for (struct packed_git *p = packfile_store_get_all_packs(r->objects->packfiles);
             p; p = p->next) {
                char *pack_bitmap_name = pack_bitmap_filename(p);
                res |= verify_bitmap_file(r->hash_algo, pack_bitmap_name);
index a9d9855063aea85f4b1b8f70f301c644c5d5e225..d8eb679735484a17196ba9d77ac6c8c7bfff2536 100644 (file)
@@ -86,6 +86,7 @@ struct object_entry *packlist_find(struct packing_data *pdata,
 
 static void prepare_in_pack_by_idx(struct packing_data *pdata)
 {
+       struct packfile_store *packs = pdata->repo->objects->packfiles;
        struct packed_git **mapping, *p;
        int cnt = 0, nr = 1U << OE_IN_PACK_BITS;
 
@@ -95,7 +96,7 @@ static void prepare_in_pack_by_idx(struct packing_data *pdata)
         * (i.e. in_pack_idx also zero) should return NULL.
         */
        mapping[cnt++] = NULL;
-       for (p = get_all_packs(pdata->repo); p; p = p->next, cnt++) {
+       for (p = packfile_store_get_all_packs(packs); p; p = p->next, cnt++) {
                if (cnt == nr) {
                        free(mapping);
                        return;
index b37f43afb587a59ddf12dc015664273a0b94083c..cd5431b6aa18801d871a23f75c8e45a0152f9ca7 100644 (file)
@@ -1033,11 +1033,11 @@ struct packed_git *packfile_store_get_packs(struct packfile_store *store)
        return store->packs;
 }
 
-struct packed_git *get_all_packs(struct repository *r)
+struct packed_git *packfile_store_get_all_packs(struct packfile_store *store)
 {
-       packfile_store_prepare(r->objects->packfiles);
+       packfile_store_prepare(store);
 
-       for (struct odb_source *source = r->objects->sources; source; source = source->next) {
+       for (struct odb_source *source = store->odb->sources; source; source = source->next) {
                struct multi_pack_index *m = source->midx;
                if (!m)
                        continue;
@@ -1045,7 +1045,7 @@ struct packed_git *get_all_packs(struct repository *r)
                        prepare_midx_pack(m, i);
        }
 
-       return r->objects->packfiles->packs;
+       return store->packs;
 }
 
 struct list_head *get_packed_git_mru(struct repository *r)
@@ -2105,7 +2105,7 @@ struct packed_git **kept_pack_cache(struct repository *r, unsigned flags)
                 * covers, one kept and one not kept, but the midx returns only
                 * the non-kept version.
                 */
-               for (p = get_all_packs(r); p; p = p->next) {
+               for (p = packfile_store_get_all_packs(r->objects->packfiles); p; p = p->next) {
                        if ((p->pack_keep && (flags & ON_DISK_KEEP_PACKS)) ||
                            (p->pack_keep_in_core && (flags & IN_CORE_KEEP_PACKS))) {
                                ALLOC_GROW(packs, nr + 1, alloc);
@@ -2202,7 +2202,7 @@ int for_each_packed_object(struct repository *repo, each_packed_object_fn cb,
        int r = 0;
        int pack_errors = 0;
 
-       for (p = get_all_packs(repo); p; p = p->next) {
+       for (p = packfile_store_get_all_packs(repo->objects->packfiles); p; p = p->next) {
                if ((flags & FOR_EACH_OBJECT_LOCAL_ONLY) && !p->pack_local)
                        continue;
                if ((flags & FOR_EACH_OBJECT_PROMISOR_ONLY) &&
index 0b691ded7ef12a053abb1df5d98c8b45c014bcd9..1afb9cd6641696287e4b310d8139a38ce4bc4c23 100644 (file)
@@ -142,6 +142,12 @@ void packfile_store_add_pack(struct packfile_store *store,
  */
 struct packed_git *packfile_store_get_packs(struct packfile_store *store);
 
+/*
+ * Get all packs managed by the given store, including packfiles that are
+ * referenced by multi-pack indices.
+ */
+struct packed_git *packfile_store_get_all_packs(struct packfile_store *store);
+
 /*
  * Open the packfile and add it to the store if it isn't yet known. Returns
  * either the newly opened packfile or the preexisting packfile. Returns a
@@ -227,7 +233,6 @@ int for_each_packed_object(struct repository *repo, each_packed_object_fn cb,
 extern void (*report_garbage)(unsigned seen_bits, const char *path);
 
 struct list_head *get_packed_git_mru(struct repository *r);
-struct packed_git *get_all_packs(struct repository *r);
 
 /*
  * Give a rough count of objects in the repository. This sacrifices accuracy
index 9bb30d9ab71d2231905a031a7e8f173e31585a67..1d33de821e9f5e5b470dd618127b8354fb580009 100644 (file)
@@ -287,12 +287,13 @@ static int compare_info(const void *a_, const void *b_)
 
 static void init_pack_info(struct repository *r, const char *infofile, int force)
 {
+       struct packfile_store *packs = r->objects->packfiles;
        struct packed_git *p;
        int stale;
        int i;
        size_t alloc = 0;
 
-       for (p = get_all_packs(r); p; p = p->next) {
+       for (p = packfile_store_get_all_packs(packs); p; p = p->next) {
                /* we ignore things on alternate path since they are
                 * not available to the pullers in general.
                 */
index 611a13a32610d2f291d89ef1aca12aab1383c335..e001dc3066db70ed08da78f1566eb9f764d93619 100644 (file)
@@ -39,7 +39,7 @@ int cmd__find_pack(int argc, const char **argv)
        if (repo_get_oid(the_repository, argv[0], &oid))
                die("cannot parse %s as an object name", argv[0]);
 
-       for (p = get_all_packs(the_repository); p; p = p->next)
+       for (p = packfile_store_get_all_packs(the_repository->objects->packfiles); p; p = p->next)
                if (find_pack_entry_one(&oid, p)) {
                        printf("%s\n", p->pack_name);
                        actual_count++;
index d51aaa3dc40d1287c60d2058b94404df777e7ee4..7c428c16011a23d18855e87865e1d21d99bb27e0 100644 (file)
@@ -37,7 +37,7 @@ int cmd__pack_mtimes(int argc, const char **argv)
        if (argc != 2)
                usage(pack_mtimes_usage);
 
-       for (p = get_all_packs(the_repository); p; p = p->next) {
+       for (p = packfile_store_get_all_packs(the_repository->objects->packfiles); p; p = p->next) {
                strbuf_addstr(&buf, basename(p->pack_name));
                strbuf_strip_suffix(&buf, ".pack");
                strbuf_addstr(&buf, ".mtimes");