Add projectile-switch-sibling-project - #2148
Merged
Merged
Conversation
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
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 noffers 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
projectileitself 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
-modepackage to every other one and everydocs.site to the rest, which is reading more into a name than is there.