-
Notifications
You must be signed in to change notification settings - Fork 68
Closed
Description
Description
When a branch is checked out in the main working tree (not a linked worktree), git gtr ai <branch> and git gtr go <branch> fail with "Worktree not found for branch", even though git worktree list correctly shows it.
The root cause is that resolve_target()/resolve_worktree() only searches linked worktrees in the worktrees directory and does not consider the main working tree as a valid match.
This is distinct from #123, which was about discover_repo_root() returning the wrong path when called from inside a linked worktree.
Steps to reproduce
# Main repo has branch checked out
cd ~/Code/my-repo
git checkout my-feature-branch
# git worktree list shows it correctly
git worktree list
# /Users/me/Code/my-repo abc1234 [my-feature-branch]
# /Users/me/Code/my-repo-worktrees/other def5678 [other-branch]
# But git gtr can't find it
git gtr ai my-feature-branch
# [x] Worktree not found for branch: my-feature-branch
git gtr go my-feature-branch
# [x] Worktree not found for branch: my-feature-branchExpected behaviour
git gtr should recognise the main working tree when resolving a branch name, falling through to it when no linked worktree matches.
Environment
- git gtr version 2.3.0 (installed via Homebrew)
- git version 2.48.1
- macOS (Apple Silicon)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels