Re: [PATCH 40/44] packfile: allow prepare_packed_git to handle arbitrary repositories
From: Junio C Hamano <hidden>
Date: 2018-03-22 01:47:21
Brandon Williams [off-list ref] writes:
On 03/03, Nguyễn Thái Ngọc Duy wrote:quoted
From: Stefan Beller <redacted> Signed-off-by: Stefan Beller <redacted> Signed-off-by: Junio C Hamano <redacted> Signed-off-by: Nguyễn Thái Ngọc Duy <redacted> ---This is an invalid conversion.quoted
packfile.c | 18 +++++++++--------- packfile.h | 3 +-- 2 files changed, 10 insertions(+), 11 deletions(-)diff --git a/packfile.c b/packfile.c index 52febba932..2276e2ad26 100644 --- a/packfile.c +++ b/packfile.c@@ -882,19 +882,19 @@ static void prepare_packed_git_mru(struct repository *r) list_add_tail(&p->mru, &r->objects.packed_git_mru); } -void prepare_packed_git_the_repository(void) +void prepare_packed_git(struct repository *r) { struct alternate_object_database *alt; - if (the_repository->objects.packed_git_initialized) + if (r->objects.packed_git_initialized) return; - prepare_packed_git_one(the_repository, get_object_directory(), 1); - prepare_alt_odb(the_repository); - for (alt = the_repository->objects.alt_odb_list; alt; alt = alt->next) - prepare_packed_git_one(the_repository, alt->path, 0); - rearrange_packed_git(the_repository); - prepare_packed_git_mru(the_repository); - the_repository->objects.packed_git_initialized = 1; + prepare_packed_git_one(r, get_object_directory(), 1);Calling get_object_directory() returns the_repository's object dir, this needs to be replaced with r->objects.objectdir.
Nicely spotted. I think this was inherited from the orginal, e.g. the one from the end of last month https://public-inbox.org/git/20180228010608.215505-9-sbeller@google.com/ also calls get_object_directory(). Thanks.