-
Notifications
You must be signed in to change notification settings - Fork 102
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
Add force branch name settings #519
base: intellij2020.3
Are you sure you want to change the base?
Add force branch name settings #519
Conversation
It forces the usage of git review branch name by default, even with local branches It helps the classic workflow to always push on master, other branches are exceptional
@Al3xCalibur Sorry, I somehow missed this PR. Just looked into it now. This new option only works with a |
Hey, thanks for the answer! Yes, it is based on the similar behaviour for a single repo It makes complete sense to fallback on the default branch |
Do you think you could add this to your PR? I tested the current status, and code looks good as well. |
Yes, I can do it this evening (I've already started to re-setup my PC for the project) |
I've tried to get the default branch for a repo, but I can't find a reasonable way (aka with git4idea) |
Thanks for looking into that. In that case, I would suggest that you add a hint to the settings label that it only works in case |
I finally found a way |
Retrieving the remote default branch name requires the CLI In that case, it does some network call so it can be quite long That's why the swing worker as been introduced
Hey, I've pushed a proposition. And all the ways to get the remote default branch name requires a bit of IO, but it is probably fine in a worker and as an opt-in option I've tested locally seems fine on a normal git repo, but I can test it on gerrit on Monday |
Thanks, it really looks the remote call is required in this case. I have the feeling that |
Thanks, I will have a look at this methods |
It creates tasks on idea, rather than custom swing code
Code looks good, thanks! Did you test the following cases:
|
I've tested options 2 and 3, but not 1 |
Same limitation than push by default on gerrit
I've tried the option 1, it works fine |
One main idea of Gerrit's flow is to push on master, with custom git behaviours.
Thus on remote, it is very exceptional to work on another branch.
But locally, it still makes sense to use branches and to push on master.
Especially allows for a nice presentation on Gerrit with the "pushed together commits"
That's why it makes sense for the plugin to force the main branch based on the gitreview file.
But it only covers the case of a single local repo/gerritPushTargetPanel.
For multiple ones, we must type "master" in the branch input each time we push using a local branch.
It happens very often in my case.
Given I'm not sure everyone wants that behaviour (and I tried to understand the codebase), I've added a specific setting