Commit dbc73f7
git: discover worktrees when opening a worktree directory
When a worktree directory is opened with `git.detectWorktrees` enabled,
`checkForWorktrees()` previously returned early without discovering the
main repository or sibling worktrees. This left worktree management
commands non-functional because:
- Commands like "Create Worktree" filter for repository/submodule kind
- "Open Worktree" requires gitOpenRepositoryCount > 1
- SCM menu items depend on a repository-kind provider being open
Remove the early return for worktree-kind repositories and instead
always filter out the current repository from the candidate list. This
enables bidirectional worktree discovery (worktree → main repo, and
main repo → worktrees) and also fixes a pre-existing off-by-one in the
limit/warning logic where the main repo counted itself as a candidate.
The existing `isRepositoryOutsideWorkspace()` check already allows this
because it recognizes paths that appear in any open repository's worktree
list, and `getRepositoryExact()` prevents duplicate/recursive opens.
Also fixes a confusing log message that said detection "is not skipped"
when it was in fact skipping.
Fixes #264209
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 78e3397 commit dbc73f7
1 file changed
+7
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
807 | 807 | | |
808 | 808 | | |
809 | 809 | | |
810 | | - | |
811 | | - | |
812 | | - | |
813 | | - | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
814 | 814 | | |
815 | | - | |
816 | | - | |
| 815 | + | |
| 816 | + | |
817 | 817 | | |
818 | 818 | | |
819 | 819 | | |
820 | | - | |
| 820 | + | |
821 | 821 | | |
822 | 822 | | |
823 | 823 | | |
| |||
0 commit comments