Subject: Re: [PATCH 12/17] odb: trivial refactorings to get rid of `the_repository`

From: Junio C Hamano <[email-masked]>
Date: Wed, 07 May 2025 09:38:52 -0700

Derrick Stolee <[email-masked]> writes:

> On 5/6/25 7:09 AM, Patrick Steinhardt wrote:
>> All of the external functions provided by the object database subsystem
>> don't depend on `the_repository` anymore, but some internal functions
>> still do. Refactor those cases by plumbing through the repository that
>> owns the object database.
>> This change allows us to get rid of the
>> `USE_THE_REPOSITORY_VARIABLE`
>> preprocessor define.
>
>> --- a/odb.c
>> +++ b/odb.c
>> @@ -1,5 +1,3 @@
>> -#define USE_THE_REPOSITORY_VARIABLE
>> -
>
> Very satisfying! Thanks,

Yes, nice outcome.  I looked at the resulting odb.c and was a bit
unhappy to see that we still need to pass "struct repository *"
(instead of "struct object_database *") around.  But that is not
because we assume we can get to an odb via repo, but primarily
because repo has many things like config access and hash-algo that
we rely on, so it is perfectly OK.

At some places, where we pass odb around, we can and do go from it
to its repository (e.g. odb->repo->hash_algo), which was what I am
expecting to see more of in the future.

Thanks.