Add git worktree support#21
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Enhances repository detection and URL generation to support Git worktrees and bare repositories by switching to git rev-parse --show-toplevel / --absolute-git-dir, and modernizes provider loading and related tests.
Changes:
- Update git path detection to use
rev-parse --show-toplevelwith a bare-repo fallback to--absolute-git-dir. - Improve detached-HEAD handling by falling back to full commit SHA for the current ref.
- Refactor provider loading to simplify data structures and make tests order-independent; add a worktree-focused integration test.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
open/provider.go |
Simplifies provider aggregation while parsing git config provider entries. |
open/provider_test.go |
Makes provider comparisons deterministic by sorting slices before comparison. |
open/open.go |
Switches repo root detection to rev-parse to support worktrees/bare repos and tightens provider matching by host. |
open/open_test.go |
Adds a worktree test and extends remote parsing tests for local-path remotes. |
gitw/gitw.go |
Introduces Toplevel / AbsoluteGitDir, refactors git invocation options, and improves detached-HEAD ref resolution. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Enhance Git repository detection by using 'git rev-parse --show-toplevel' and '--absolute-git-dir', enabling native support for Git worktrees and bare repositories. Current reference detection now correctly falls back to full commit SHAs when in a detached HEAD state. Modernize internal logic using Go 1.24+ iterators and simplified data structures for provider loading.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Enhance Git repository detection by using 'git rev-parse --show-toplevel'
and '--absolute-git-dir', enabling native support for Git worktrees and
bare repositories. Current reference detection now correctly falls back
to full commit SHAs when in a detached HEAD state.
Modernize internal logic using Go 1.24+ iterators and simplified data
structures for provider loading.