[PATCH v3 0/5] Encode submodule gitdir names to avoid conflicts
- From
Adrian Ratiu <adrian.ratiu@collabora.com>
- Date
- Oct 6, 2025, 11:25 UTC
- Message-ID
- <20251006112518.3764240-1-adrian.ratiu@collabora.com>
- In-Reply-To
- <20250816213642.3517822-1-adrian.ratiu@collabora.com>
Hello everyone,
v3 is much simplified from v2, starting from the design idea that submodule gitdir name encoding is to be put behind an extensions.submoduleEncoding.
This allowed removal of the modules vs submodules directories split and simplified our logic quite a lot. Tests have been been squashed in the smaller commits as well.
Many thanks to all who provided feedback, especially Patrick and Phillip who suggested the extension idea.
This is based on the latest master branch and I've also merged and tested against next.
I pushed the patches to github [1] and also did a CI run [2] which passed (the lone Win+Meson CI failure seems to be unrelated because it reproduces without the patches).
[1] https://github.com/10ne1/git/tree/dev/aratiu/encoding-v3 [2] https://github.com/10ne1/git/actions/runs/18276914867
Changes between v2 -> v3: * Put submodule encoding behind an extension (Phillip & Patrick). * Removed the submodules vs modules directory split (Patrick). * Undeleted validate_submodule_git_dir() because it still needs to check the default. * Undeleted tests from t7450-bad-git-dotfiles.sh because they are still required. * Moved new tests to a new file which enables the extension. * Moved unused variables to commit which uses them (Szeder Gabor). * Squashed commits to reduce their number (e.g. tests are together with new logic). * Fixed a small bug passing the module repo instead of the_repo to the gitdir helper. * Small commit msg rewording improvements, typos (Kristoffer & Phillip).
Adrian Ratiu (5): submodule--helper: use submodule_name_to_gitdir in add_submodule submodule: add gitdir path config override strbuf: bring back is_rfc3986_unreserved submodule: encode gitdir paths to avoid conflicts submodule: error out if gitdir name is too long
Documentation/config/extensions.adoc | 9 ++ Documentation/config/submodule.adoc | 7 ++ Makefile | 5 + builtin/credential-store.c | 6 - builtin/submodule--helper.c | 30 ++++- compat/pathconf.c | 10 ++ compat/posix.h | 8 ++ config.mak.uname | 2 + meson.build | 1 + repository.h | 1 + setup.c | 7 ++ setup.h | 1 + strbuf.c | 6 + strbuf.h | 2 + submodule.c | 84 +++++++++---- t/lib-verify-submodule-gitdir-path.sh | 20 ++++ t/meson.build | 1 + t/t7400-submodule-basic.sh | 9 ++ t/t7425-submodule-encoding.sh | 162 ++++++++++++++++++++++++++ t/t9902-completion.sh | 1 + 20 files changed, 340 insertions(+), 32 deletions(-) create mode 100644 compat/pathconf.c create mode 100644 t/lib-verify-submodule-gitdir-path.sh create mode 100755 t/t7425-submodule-encoding.sh
-- 2.49.1