Skip to content

Add git worktree support#21

Merged
arbourd merged 1 commit into
mainfrom
add-worktree
May 8, 2026
Merged

Add git worktree support#21
arbourd merged 1 commit into
mainfrom
add-worktree

Conversation

@arbourd
Copy link
Copy Markdown
Owner

@arbourd arbourd commented May 8, 2026

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.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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-toplevel with 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.

Comment thread gitw/gitw.go
Comment thread open/open.go
Comment thread open/open_test.go Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Comment thread open/open.go
Comment thread open/open.go
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.
@arbourd arbourd merged commit 9260075 into main May 8, 2026
4 checks passed
@arbourd arbourd deleted the add-worktree branch May 8, 2026 22:32
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