Subject: [PATCH 0/9] Encode submodule gitdir names to avoid conflicts

From: Adrian Ratiu <[email-masked]>
Date: Sun, 17 Aug 2025 00:36:33 +0300

Hello,

This is a continuation of work done back in 2018 [1], so a big thank you to
everyone who participated in the initial thread, especially Brandon on whose
code this is partially based upon. Hope you are still around and doing well. :)

It's mostly a rewrite from scratch addressig open feedback. I decided to
iterate upen Brandon's url-encoding design instead of pursuing alternatives
like a custom encoding, name hashing or round-trip encoding/decoding using
an in-memory git mapping (we'd still have to encode/hash the paths to avoid
colflicts so IIUC this last one is more complicated for little gain).

I tried to organize and explain the commits in a logical way which is also
easy to review, keeping the encoding parts, new tests, code moving around
and path update churn as clearly separated as possible.

This is based on master and I've merged and succesfully run all tests in
both the next and seen branches.

P.S. I plan to give a short talk at the mini-summit in 2 weesks based on this
series and some other patches I wish to propose on the ML, so if any of you
are attending and wish to connect in person, see you there!

Link: https://lore.kernel.org/git/[email-masked]/ [1]

Adrian Ratiu (9):
  submodule--helper: use submodule_name_to_gitdir in add_submodule
  submodule: create new gitdirs under submodules path
  submodule: add gitdir path config override
  t: submodules: add basic mixed gitdir path tests
  strbuf: bring back is_rfc3986_unreserved
  submodule: encode gitdir paths to avoid conflicts
  submodule: remove validate_submodule_git_dir()
  t: move nested gitdir tests to proper location
  t: add gitdir encoding tests

 Documentation/fetch-options.adoc           |   2 +-
 Documentation/git-fetch.adoc               |   2 +-
 Documentation/git-submodule.adoc           |   2 +-
 Documentation/gitsubmodules.adoc           |   8 +-
 builtin/credential-store.c                 |   6 -
 builtin/submodule--helper.c                |  49 +++--
 setup.c                                    |   2 +-
 strbuf.c                                   |   6 +
 strbuf.h                                   |   2 +
 submodule.c                                | 158 +++++++---------
 submodule.h                                |   5 -
 t/lib-submodule-update.sh                  |  50 ++---
 t/lib-verify-submodule-gitdir-path.sh      |  15 ++
 t/meson.build                              |   1 +
 t/t0035-safe-bare-repository.sh            |   4 +-
 t/t1600-index.sh                           |   4 +-
 t/t2405-worktree-submodule.sh              |   8 +-
 t/t2501-cwd-empty.sh                       |   2 +-
 t/t3600-rm.sh                              |   8 +-
 t/t5526-fetch-submodules.sh                |   2 +-
 t/t5619-clone-local-ambiguous-transport.sh |   4 +-
 t/t6120-describe.sh                        |   4 +-
 t/t7001-mv.sh                              |   4 +-
 t/t7400-submodule-basic.sh                 |  33 +++-
 t/t7406-submodule-update.sh                |  14 +-
 t/t7407-submodule-foreach.sh               |   6 +-
 t/t7408-submodule-reference.sh             |  22 +--
 t/t7412-submodule-absorbgitdirs.sh         |  22 +--
 t/t7423-submodule-symlinks.sh              |   8 +-
 t/t7425-submodule-mixed-gitdir-paths.sh    | 207 +++++++++++++++++++++
 t/t7450-bad-git-dotfiles.sh                |  73 +-------
 t/t7527-builtin-fsmonitor.sh               |   4 +-
 32 files changed, 451 insertions(+), 286 deletions(-)
 create mode 100644 t/lib-verify-submodule-gitdir-path.sh
 create mode 100755 t/t7425-submodule-mixed-gitdir-paths.sh

-- 
2.50.1.679.gbf363a8fbb.dirty