Junio C Hamano writes: > Now, for the same reason, let's allow command execution from within > the $GIT_DIR directory of a secondary worktree. This is useful for > tools working with secondary worktrees when the 'bareRepository' > setting is set to 'explicit'. Does the same reason also apply to .git/modules/$name ? > In the previous commit, we created a helper function to house the > logic that checks if a directory that looks like a bare repository > is actually a part of a non-bare repository. Extend the helper > function to also check if the apparent bare-repository is a $GIT_DIR > of a secondary worktree, by checking three things: > > * The path to the $GIT_DIR must be a subdirectory of > ".git/worktrees/", which is the primary worktree [*]. > > * Such $GIT_DIR must have file "gitdir", that records the path of > the ".git" file that is at the root level of the secondary > worktree. > > * That ".git" file in turn points back at the $GIT_DIR we are > inspecting. > > The latter two points are merely for checking sanity. The security > lies in the first requirement. In the case of .git/modules/, the second point doesn't apply because there's no gitdir file. But perhaps the core.worktree setting could be used for the same purpose. $ pwd /path/to/super/.git/modules/sub $ git config core.worktree ../../../sub