feat: make VCS marker detection order configurable#1984
Open
stribb wants to merge 1 commit intobbatsov:masterfrom
Open
feat: make VCS marker detection order configurable#1984stribb wants to merge 1 commit intobbatsov:masterfrom
stribb wants to merge 1 commit intobbatsov:masterfrom
Conversation
Owner
|
I think that's a good change. Just rebase it on top of You might also mention your usecases and the configuration somewhere in the user docs. |
Add `projectile-vcs-markers` defcustom — an ordered alist of
(MARKER . VCS-SYMBOL) pairs. `projectile-project-vcs` now iterates
this list for both the root check and dominating-file walk, replacing
the hardcoded cond. Default order is unchanged.
Users can now prioritise e.g. jj over git for colocated repos:
(push '(".jj" . jj) projectile-vcs-markers)
Author
|
Rebased onto master and added docs. Ready for merge. |
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.
Motivation
projectile-project-vcschecks VCS markers in a fixed order —.gitbefore
.jj— so a colocated jj+git repo is always detected asgit.This is a common situation rather than an edge case: jj's most popular
backend is git. When you run
jj git initin an existing repo, orclone with
jj git clone, you get a directory that contains both a.jj/folder and a.git/folder. Users of jj-on-git who wantprojectile to treat such repos as jj projects have no recourse short of
advising
projectile-project-vcs.Changes
Add
projectile-vcs-markers— an ordered alist of(marker . vcs-symbol)pairs — and rewrite
projectile-project-vcsto iterate it for both theroot check and the dominating-file walk, replacing the hardcoded
cond.The default order is unchanged from the current behaviour, so this is
backwards-compatible for all existing users.
Usage
To prefer jj over git in colocated repos:
Tests
Four new Buttercup specs in
projectile-test.elcovering:.gitrepo →git.jjrepo →jj.git+.jjwith default order →git.git+.jjwith custom order (jj first) →jj