-
Notifications
You must be signed in to change notification settings - Fork 346
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disable auto local branch creation with config option #894
Disable auto local branch creation with config option #894
Conversation
I think this makes sense. Thanks! |
00c3f3a
to
930a050
Compare
This would be pretty useful -- chooglen@, would you mind syncing and updating this PR? |
Ah, I've been updating this on my end, but haven't had the time to send it out yet. Give me a bit. |
56624bb
to
8358f6d
Compare
Okay, I think this is ready for review, PTAL :) |
08ab346
to
a967923
Compare
We'll add an import test in the next commit.
This test coverage will become more important when we make changes to remote branch importing.
965a8db
to
d02c1a6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Thanks for adding this feature!
Add a new git.auto-local-branch config option. When set to false, a remote-tracking branch imported from Git will not automatically create a local branch target. This is implemented by a new GitSettings struct that passes Git-related settings from UserSettings. This behavior is particularly useful in a co-located jj and Git repo, because a Git remote might have branches that are not of everyday interest to the user, so it does not make sense to export them as local branches in Git. E.g. https://github.com/gitster/git, the maintainer's fork of Git, has 379 branches, most of which are topic branches kept around for historical reasons, and Git developers wouldn't be expected to have local branches for each remote-tracking branch.
d02c1a6
to
3c1532a
Compare
As a Git developer, my git/git repo has https://github.com/gitster/git as an upstream. Since we create a local jj branch when we import the remote-tracking branches and then subsequently export the local branches to git, my git repo has seen a sudden explosion in the number of local branches.
This attempts to fix the problem by not creating a local branch during import. This workflow might also be desirable to users with certain remote setups that make local branch creation confusing. FWIW I think I'd sometimes like to have the local branch and sometimes not; I find automatic branch creation useful when there's only one remote, but confusing with >= 3 remotes, like my git/git repo.
An alternative solution to the branch proliferation problem would be to create the local branch but don't export it to Git (which would have also been a fix for #493). However, if we take this PR, I don't see a compelling enough reason to make the Git export configurable, especially since having more knobs makes the UX potentially more confusing.
Checklist
If applicable:
CHANGELOG.md