Re: [PATCH 40/44] packfile: allow prepare_packed_git to handle arbitrary repositories
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 22, 2018, 01:47 UTC
- Message-ID
- <xmqqr2ocnaox.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <20180321223923.GB202156@google.com>
Brandon Williams <bmwill@google.com> writes:
Show 41 quoted lines
> On 03/03, Nguyễn Thái Ngọc Duy wrote:
>> From: Stefan Beller <sbeller@google.com>
>>
>> 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>
>> ---
>
> This is an invalid conversion.
>
>> 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.