Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for worktrees in fromExisting #56

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dnys1
Copy link

@dnys1 dnys1 commented Aug 15, 2023

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:

  • gitDirRoot is not a git directory or worktree
  • gitDirRoot is a subdirectory of a git directory or worktree and allowSubdirectory is false.

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 understanding here).

The logic is refactored a bit to make clear that the only times when `GitDir.fromExisting` throws are in the cases where: `gitDirRoot` is not a git directory or worktree; or `gitDirRoot` is a subdirectory of a git directory or worktree and `allowSubdirectory` is `false`.
Copy link
Owner

@kevmoo kevmoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rebase on latest and update changelog?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants