Yoichi Nakayama's cover letter says that submodule settings in the repository config are shared across all worktrees, even when they need to differ. Different branches may use different URLs for the same submodule, for example upstream in one and a fork in another. More importantly, sharing submodule.<name>.gitdir makes submodule worktrees share the same HEAD and index even when the superproject worktrees record different submodule commits.
Patch 1 keeps submodule.<name>.gitdir relative for linked worktrees, so it keeps working when the worktree is moved along with the main worktree. This benefit also requires worktree.useRelativePaths.
Patch 2 stores settings such as submodule.<name>.active and submodule.<name>.url in the worktree config when extensions.worktreeConfig is enabled. Settings shared between worktrees can remain in the repository config. When such a setting exists there, git submodule deinit sets submodule.<name>.active to false.
Patch 3 changes git submodule init. An existing submodule.<name>.gitdir in the repository config may have been written by another worktree, and reusing it would point the current worktree at the other worktree's gitdir. The command now copies an existing setting to the worktree config only if it belongs to the current worktree, otherwise it generates a new one, and it warns when it does not copy.
The excerpts show no replies yet.