Re: [PATCH 12/17] odb: trivial refactorings to get rid of `the_repository`
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 7, 2025, 16:38 UTC
- Message-ID
- <xmqqecx0e5pf.fsf@gitster.g>
- In-Reply-To
- <728e13e3-b563-4d66-bc00-b3320b76ec9f@gmail.com>
Derrick Stolee <stolee@gmail.com> writes:
Show 16 quoted lines
> 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.