Skip to content

Conversation

acr4
Copy link

@acr4 acr4 commented Dec 20, 2023

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 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.
@admorgan admorgan self-requested a review July 7, 2024 22:17
@admorgan admorgan self-assigned this Jul 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants