When git-subrepo is invoked from a Git worktree or Git submodule, .git is a file, not a directory. As such it is necessary to traverse to the actual .git/ directory which is located elsewhere.
This patch teaches git-subrepo to use git -C $lib instead of GIT_DIR=$lib/.git git. Doing so places the burden on the Git executable to locate the canonical path of the install's .git/ directory.
While GIT_DIR has been around since Git v0.99, the -C option was "only" added in v1.8.5. Nevertheless, this does not impair git-subrepo as it already requires Git >= v2.7 due to its reliance on worktrees.
When git-subrepo is invoked from a Git worktree or Git submodule, .git is a file, not a directory. As such it is necessary to traverse to the actual .git/ directory which is located elsewhere.
This patch teaches git-subrepo to use
git -C $lib
instead ofGIT_DIR=$lib/.git git
. Doing so places the burden on the Git executable to locate the canonical path of the install's .git/ directory.While GIT_DIR has been around since Git v0.99, the
-C
option was "only" added in v1.8.5. Nevertheless, this does not impair git-subrepo as it already requires Git >= v2.7 due to its reliance on worktrees.