Re: [PATCH 8/8] setup: construct object database in `apply_repository_format()`
On Fri, May 22, 2026 at 02:59:24AM +0900, Junio C Hamano wrote:
Show 33 quoted lines
> Patrick Steinhardt <ps@pks.im> writes:
>
> > With the preceding changes we now always construct the repository's
> > object database before applying the repository format. Remove this
> > duplication by constructing it in `apply_repository_format()` instead.
> >
> > Note that we create the object database _after_ having set up the
> > repository's hash algorithm, but _before_ setting the compat hash
> > algorithm. This is intentional:
> >
> > - Constructing the object database may require knowledge of its
> > intended object format.
> >
> > - Setting up the compatibility hash requires the object database to be
> > initialized already, because we immediately read the loose object
> > map.
> >
> > The first point is sensible, the second maybe a little less so. Ideally,
> > it should be the responsibility of the object database itself to
> > initialize any data structures required for the compatibility hash. But
> > this would require further changes, so this is kept as-is for now.
>
> Yeah, I guess it is a good place to stop, instead of solving the
> chicken-and-egg problem in one go.
>
> > Further note that this requires us to move handling of the environment
> > variables GIT_OBJECT_DIRECTORY and GIT_ALTERNATE_OBJECT_DIRECTORIES into
> > the repository format, as well. This allows the caller more flexibility
> > around whether or not those environment variables are being honored, as
> > we do do want to respect them in "setup.c", but not in "repository.c".
>
> It seems that we really really really want to do so ;-). "do do
> want to" -> "do want to" or even "want to", perhaps.
Fixed locally, thanks! :)
Patrick