packfile: allow rearrange_packed_git to handle arbitrary repositories
authorStefan Beller <sbeller@google.com>
Fri, 23 Mar 2018 17:45:17 +0000 (18:45 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 26 Mar 2018 17:07:43 +0000 (10:07 -0700)
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
packfile.c
index e954b575c34a7eefedc8e21a26d8360c5fe0a0dd..326c171e9804f74d2478f70d4b7e991ffce44b3b 100644 (file)
@@ -866,10 +866,10 @@ static int sort_pack(const void *a_, const void *b_)
        return -1;
 }
 
-static void rearrange_packed_git(void)
+static void rearrange_packed_git(struct repository *r)
 {
-       the_repository->objects->packed_git = llist_mergesort(
-               the_repository->objects->packed_git, get_next_packed_git,
+       r->objects->packed_git = llist_mergesort(
+               r->objects->packed_git, get_next_packed_git,
                set_next_packed_git, sort_pack);
 }
 
@@ -893,7 +893,7 @@ void prepare_packed_git(void)
        prepare_alt_odb(the_repository);
        for (alt = the_repository->objects->alt_odb_list; alt; alt = alt->next)
                prepare_packed_git_one(alt->path, 0);
-       rearrange_packed_git();
+       rearrange_packed_git(the_repository);
        prepare_packed_git_mru(the_repository);
        the_repository->objects->packed_git_initialized = 1;
 }