Subject: Re: [PATCH v3 2/5] submodule: add gitdir path config override

From: Patrick Steinhardt <[email-masked]>
Date: Tue, 21 Oct 2025 10:06:15 +0200

On Tue, Oct 07, 2025 at 08:41:13AM -0700, Junio C Hamano wrote:
> Junio C Hamano <[email-masked]> writes:
> 
> > Adrian Ratiu <[email-masked]> writes:
> >
> > [jc: brandon removed from CC list as the address would bounce]
> >
> >> This adds the ability to override gitdir paths via config files
> >> (not .gitmodules) such that the encoding scheme (or plain text
> >> name if the encoding extension is disabled) can be changed via
> >> config entries.
> >>
> >> These entries are not added by default for all submodules: they
> >> should be used on an as-needed basis.
> >>
> >> A new test and a helper are added. The helper will also be used
> >> in further tests exercising gitdir encoding functionality.
> >
> > What is the use case of this?  The only reasonable use case I can
> > see is to set this to all the existing submodules when you are
> > switching the extension on before adding a new submodule, in which
> > case the old ones will keep using unencoded names, while the new
> > ones will use encoded ones.
> 
> Two things.
> 
>  * I no longer mind this setting existing, but I think it should not
>    be a mere "override", but the authoritative source of truth for
>    all submodules (see my other response on 0/5).

I think making this the authoritative source of truth for all submodules
in the case where the new extension is enabled does make a ton of sense.
It makes things way easier for us to reason about:

  - If the extension is set, we know to always use whatever is in the
    gitconfig.

  - If any submodule path is missing we know that we are in a broken
    repository and can abort accordingly with directions for how to fix
    things.

  - If we need to enable the extension we can trivially migrate all
    existing submodules by just writing their gitdir configuration.

  - We can change the exact encoding going forward, as the extension now
    only indicates whether or not submodule gitdirs are tracked via the
    configuration or encoded "live".

I think especially the last point is a big win, as we are not stuck with
the current encoding schema in case it proves insufficient.

Patrick