packfile: allow prepare_packed_git_mru to handle arbitrary repositories
This conversion was done without the #define trick used in the earlier series refactoring to have better repository access, because this function is easy to review, as all lines are converted and it has only one caller 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>
Stefan Beller committed
Mar 23, 2018 at 18:45 UTC
804be79690287e2fdb95f4ce66504f9aed5dcf8f
1 file changed
+5
-5
packfile.c
+5
-5
@@ -873,14 +873,14 @@ static void rearrange_packed_git(void)
873
set_next_packed_git, sort_pack);
874
}
875
876
-static void prepare_packed_git_mru(void)
876
+static void prepare_packed_git_mru(struct repository *r)
877
{
878
struct packed_git *p;
879
880
- INIT_LIST_HEAD(&the_repository->objects->packed_git_mru);
880
+ INIT_LIST_HEAD(&r->objects->packed_git_mru);
881
882
- for (p = the_repository->objects->packed_git; p; p = p->next)
883
- list_add_tail(&p->mru, &the_repository->objects->packed_git_mru);
882
+ for (p = r->objects->packed_git; p; p = p->next)
883
+ list_add_tail(&p->mru, &r->objects->packed_git_mru);
884
}
885
886
void prepare_packed_git(void)
@@ -894,7 +894,7 @@ void prepare_packed_git(void)
894
for (alt = the_repository->objects->alt_odb_list; alt; alt = alt->next)
895
prepare_packed_git_one(alt->path, 0);
896
rearrange_packed_git();
897
- prepare_packed_git_mru();
897
+ prepare_packed_git_mru(the_repository);
898
the_repository->objects->packed_git_initialized = 1;
899
}
900