Re: [PATCH 3/5] setup: defer object database creation

Patrick Steinhardt <[email protected]> Tue, 4 Aug 2026 09:21:41 +0200
Newsgroups org.kernel.vger.git
Message-ID <[email protected]>
On Tue, Jul 28, 2026 at 04:13:42PM -0500, Justin Tobler wrote:
> On 26/07/24 05:48AM, Patrick Steinhardt wrote:
> > In a subsequent commit we'll make the creation of the on-disk data
> > structures of an object database pluggable. This will lead to an
> > in-between state where we have already configured the repository's
> > object database, but it's not usable yet until we eventually call
> > `create_object_directory()`.
> >
> > Defer the object database creation so that we handle both steps in the
> > same function.
> 
> So IIUC, the repository gets configured via `apply_repository_format()`
> which invokes `odb_new()`. In this patch a
> APPLY_REPOSITORY_FORMAT_SKIP_ODB_CREATION flag is introduced to allow
> the creation of the ODB to be delayed until after source specific
> on-disk state has been created.
> 
> Naive question: would it be simpler to just require invoking `odb_new()`
> explicitly after `apply_repository_format()` in all cases? There doesn't
> appear to be too many callsites.

I don't think it would, mostly because the logic to figure out the
object directory and the alternate object directory requires a bunch of
logic.

I think it'll ultimately become simpler though once we move into the
direction of what we've discussed in [1], where we said that we want to
move handling of those environment variables into the "files" backend,
too. And then it might make sense to revisit this.

Patrick