Re: [PATCH v4 4/6] setup: defer object database creation

Patrick Steinhardt <[email protected]> Thu, 6 Aug 2026 16:54:31 +0200
Newsgroups org.kernel.vger.git
Message-ID <[email protected]>
On Thu, Aug 06, 2026 at 04:23:17PM +0200, Toon Claes wrote:
> Patrick Steinhardt <[email protected]> writes:
> > diff --git a/setup.c b/setup.c
> > index 5dfab3e79e..e39a1646bb 100644
> > --- a/setup.c
> > +++ b/setup.c
> > @@ -1765,8 +1765,6 @@ int apply_repository_format(struct repository *repo,
> >  			    enum apply_repository_format_flags flags,
> >  			    struct strbuf *err)
> 
> I've noticed the docs in setup.h say:
> 
>     /*
>      * Apply the given repository format to the repo. This initializes extensions
>      * and basic data structures required for normal operation. Returns 0 on
>      * success, a negative error code when the format is not valid as determined by
>      * `verify_repository_format()`.
>      */
> 
> I'm not sure that's still applicable, now odb_new() isn't called no
> more.

Fair enough.

> > @@ -2864,9 +2862,9 @@ int init_db(struct repository *repo,
> >  	 */
> >  	read_and_verify_repository_format(&repo_fmt, repo_get_git_dir(repo), NULL);
> >  	repository_format_configure(&repo_fmt, hash, ref_storage_format);
> > -	if (apply_repository_format(repo, &repo_fmt, APPLY_REPOSITORY_FORMAT_HONOR_ENV, &err) < 0)
> > +	if (apply_repository_format(repo, &repo_fmt,
> > +				    APPLY_REPOSITORY_FORMAT_HONOR_ENV, &err) < 0)
> 
> Nit: Not sure why this formatting change was needed. I would have
> assumed to have all apply_repository_format() calls formatted the same,
> but I've noticed at line 1883 in enter_repo() it's still a single-line
> call.

It's an artifact from previous versions.

I'll send a (hopefully last) reroll in a bit. Thanks!

Patrick