Subject: Re: [PATCH 04/12] setup: start tracking ref storage format when

From: Patrick Steinhardt <[email-masked]>
Date: Thu, 28 Dec 2023 21:01:55 +0100

On Thu, Dec 28, 2023 at 09:15:29AM -0800, Junio C Hamano wrote:
> Patrick Steinhardt <[email-masked]> writes:
> 
> > Makes me wonder whether we should then also add the following diff to
> > "setup: set repository's format on init" when both topics are being
> > merged together:
> >
> > diff --git a/setup.c b/setup.c
> > index 3d980814bc..3d35c78c68 100644
> > --- a/setup.c
> > +++ b/setup.c
> > @@ -2210,6 +2210,7 @@ int init_db(const char *git_dir, const char *real_git_dir,
> >  	 * format we can update the repository's settings accordingly.
> >  	 */
> >  	repo_set_hash_algo(the_repository, repo_fmt.hash_algo);
> > +	repo_set_compat_hash_algo(the_repository, repo_fmt.compat_hash_algo);
> >  	repo_set_ref_storage_format(the_repository, repo_fmt.ref_storage_format);
> >  
> >  	if (!(flags & INIT_DB_SKIP_REFDB))
> 
> Shouldn't that come from the series that wants .compat_hash_algo in
> the repo_fmt structure, whichever it is, not added by an evil merge?

Well, the above code is newly added by my series to ensure that
`init_db()` results in a properly initialized repo upon return. So the
compat hash algo series cannot yet call `repo_set_compat_hash_algo()`
because the code site doesn't exist, whereas my series cannot yet add
the call because there is no compat hash algo yet.

So depending on which series lands first we'll either have to adapt the
respective other series or do an evil merge.

Patrick