ingydotnet / git-subrepo

MIT License
3.18k stars 263 forks source link

Report git-subrepo's command info from non-standard installations #606

Open acr4 opened 6 months ago

acr4 commented 6 months ago

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.