Skip to content

Stop offering the enclosing repository's worktrees - #2150

Merged
bbatsov merged 1 commit into
masterfrom
fix/worktree-fallbacks
Aug 7, 2026
Merged

Stop offering the enclosing repository's worktrees#2150
bbatsov merged 1 commit into
masterfrom
fix/worktree-fallbacks

Conversation

@bbatsov

@bbatsov bbatsov commented Aug 7, 2026

Copy link
Copy Markdown
Owner

Spotted while thinking about what these commands do when there's no repository to identify.

A project marked out by its own .projectile inside a bigger repository was being offered that repository's worktrees. projectile-project-vcs says git for such a project - it walks up so file listing still works - and the worktree lookup took that as license to ask git, which listed worktrees that are copies of the repository, not of the project. Picking one landed you somewhere unrelated. The identity layer already drew this distinction; the git lookup just wasn't using it.

The rest is making the two commands explain themselves when they come up empty. "No other checkout found" reads as "I looked", which is misleading when the project is under Subversion and Projectile can't look at all - that now says so and points at s-p n, which needs no repository at all. A sibling lookup finding nothing is likewise an ordinary result of the share cap rather than a fault, so it points at projectile-project-groups.

No CHANGELOG entry - this is all refining #2147 and #2148, neither of which has been in a release.

A project marked out by its own .projectile inside a larger repository
was being offered that repository's worktrees. `projectile-project-vcs'
answers `git' for such a project - it walks up to find the repository, so
that file listing still works - and the worktree lookup took that as
license to ask git, which happily listed worktrees that are copies of the
repository, not of the project. Switching to one landed you somewhere
unrelated.

The repository identity layer already made this distinction; the git
lookup just wasn't using it. It now requires the project to hold a .git
of its own, which is exactly what being a checkout means.

While here, make the two commands explain themselves when they come up
empty. "No other checkout found" reads as "I looked" - unhelpful when the
project is under Subversion and Projectile can't look at all, so that
case now says so and points at the sibling command, which needs no
repository. And a sibling lookup finding nothing is an ordinary outcome
of the share cap rather than a fault, so it points at
`projectile-project-groups'.

No CHANGELOG entry: all of this is refining code from #2147 and #2148,
which haven't been in a release yet.
@bbatsov
bbatsov merged commit baebab1 into master Aug 7, 2026
10 checks passed
@bbatsov
bbatsov deleted the fix/worktree-fallbacks branch August 7, 2026 13:30
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.

1 participant