git
git copied to clipboard
Add support for worktrees in `fromExisting`
Adds support for worktree paths in GitDir.fromExisting. Worktrees are identified based on whether the $GIT_DIR and $GIT_COMMON_DIR are different (although not sure there are any edge cases worth considering here).
The logic is refactored a bit to make clear that the only times when GitDir.fromExisting throws are in the cases where:
-
gitDirRootis not a git directory or worktree -
gitDirRootis a subdirectory of a git directory or worktree andallowSubdirectoryisfalse.