Subject: Re: [PATCH v6 00/10] Add submodulePathConfig extension and gitdir encoding

From: Adrian Ratiu <[email-masked]>
Date: Wed, 17 Dec 2025 10:17:33 +0200

On Tue, 16 Dec 2025, Josh Steadmon <[email-masked]> wrote:
> On 2025.12.13 10:08, Adrian Ratiu wrote:
>> Hello everyone,
>> 
>> For those new to the series, we're implementing a submodule gitdir
>> extension which allows us to have a unified way to determine gitdirs
>> and do things like encode submodule paths to avoid FS conflicts.
>
> I'm afraid I've gotten a bit lost with this series. IIUC, we no longer
> try to encode submodule gitdirs by default, instead we do this only if
> we detect a conflict with an existing gitdir. However, in all of my
> local testing, I have been unable to produce a conflict that triggers
> this encoding. Instead, everything hits the error:
>   "fatal: A git directory for 'nested%2fsub' is found locally with remote(s):"
> from `builtin/submodule--helper.c:3389`.
>
> This happens regardless of the setting of
> `extensions.submodulepathconfig` in either the repo's local config, or
> my user config.
>
> My testing setup has been as follows:
> * Using our locally-built Git with our downstream patch of [1] included:
>   * create a repo "sub"
>   * create a repo "super"
>   * In "super":
>     * mkdir nested
>     * git submodule add ../sub nested/sub
>     * Verify that the submodule's gitdir is .git/modules/nested%2fsub
> * Using a build of git from upstream `next` plus this series:
>   * git config set --global extensions.submodulepathconfig true
>   * git clone --recurse-submodules super super2
>   * create a repo "nested%2fsub"
>   * In "super2":
>     * git submodule add ../nested%2fsub
>
> At this point I'd expect the collision detection / encoding to take
> effect, but instead I get the error listed above.

This is a good test case, thanks, I will add something very similar to
t7425-submodule-gitdir-path-extension.sh in v7.

Please wait for v7, where I will fix the global config, then you can
retry the steps above.

Just one important thing to look out for:

Existing submodules will _not_ get their submodule.<name>.gitdir
automatically created when enabling the extension, so you will get
errors like "gitdir does not exist" after enabling the extension.

Those are expected and I assume you already got errors like those.

The gitdirs can be created manually, for example:
git config submodule.<name>.gitdir .git/modules/<name>

Or they can all be created automatically:
git submodule--helper migrate-gitdir-configs

When running the migration command in a repo containing submodules, it
will also enable the extension in the super repo config, in addition to
creating all the submodule gitdirs configs, so running just that single
command should be enough.

Hope this all makes sense and happy to answer any questions,
Adrian