Skip to content

Add projectile-switch-sibling-project - #2148

Merged
bbatsov merged 1 commit into
masterfrom
feature/sibling-projects
Aug 7, 2026
Merged

Add projectile-switch-sibling-project#2148
bbatsov merged 1 commit into
masterfrom
feature/sibling-projects

Conversation

@bbatsov

@bbatsov bbatsov commented Aug 7, 2026

Copy link
Copy Markdown
Owner

Plenty of work spans several repositories - a library and the app using it, a tool and its docs site, the handful of packages that make up one project. They're separate projects and should stay that way, but moving between them shouldn't mean paging through everything on the machine.

s-p n offers just the related ones: groups you configured, then projects whose upstream has the same owner, then ones whose directory name starts with the same word.

The owner of the remote is by far the best of the guessed signals. On my machine it relates haystack, orchard, port and sayid to cider, which nothing based on directory names would ever manage. It does need a bound - about 40% of what I have checked out is under my own account, and "same account" relates nothing - so an inferred group covering more than a quarter of the known projects gets dropped and the next signal takes over. That's why projectile itself comes back with nothing here; a configured group is the answer for that one.

Only the leading word of a name counts. Matching on any shared word relates every -mode package to every other one and every docs. site to the rest, which is reading more into a name than is there.

Work often spans several repositories - a library and the app using it, a
tool and its documentation site, the packages that make up one project.
They're separate projects and should stay that way, but moving between
them shouldn't mean paging through every project on the machine.

`s-p n' offers just the related ones. Configured groups come first, then
projects whose upstream has the same owner, then ones whose directory
name starts with the same word.

The owner of the remote turns out to be by far the best of the inferred
signals: on my own machine it relates haystack, orchard, port and sayid
to cider, which no amount of looking at directory names ever would. It
needs a bound, though - two thirds of what I have checked out is under
one account, and "same account" doesn't relate anything to anything. A
group covering more than a quarter of the known projects is dropped so
the next signal gets its turn.

Only the *leading* word of a name counts. Matching any shared word reads
more into a name than is there: it relates every `-mode' package to every
other and every `docs.' site to the rest.
@bbatsov
bbatsov merged commit 6ffec8d into master Aug 7, 2026
10 checks passed
@bbatsov
bbatsov deleted the feature/sibling-projects branch August 7, 2026 12:04
bbatsov added a commit that referenced this pull request Aug 7, 2026
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.
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