uwolfer/gerrit-intellij-plugin

Cannot push anything to Eclipse Gerrit instance

kriegaex opened this issue · 9 comments

I am struggling with using this plugin as a Gerrit newbie for contributing to the Eclipse JDT Core project:

I can push from the Git command line, but not via the Gerrit plugin, even though the plugin correctly lists changes on the server, i.e. it has a connection. Either the plugin connects to one of my other remotes (usually origin, but the name of the Gerrit remote is something different) or actually tries to push something to Gerrit, but the server always says:

git -c credential.helper= -c core.quotepath=false -c log.showSignature=false push --progress --porcelain gerrit refs/heads/master_gerrit:master
...
remote: error: branch refs/heads/master:        
remote: To push into this reference you need 'Push' rights.        
remote: User: akriegisch        
remote: Contact an administrator to fix the permissions        
remote: 
remote: Processing changes: refs: 1
remote: Processing changes: refs: 1, done            
error: failed to push some refs to 'ssh://git.eclipse.org:29418/jdt/eclipse.jdt.core'
To ssh://git.eclipse.org:29418/jdt/eclipse.jdt.core
!	refs/heads/master_gerrit:refs/heads/master	[remote rejected] (prohibited by Gerrit: not permitted: update)

Actually, this is what I do on the command line:

git push gerrit HEAD:refs/for/master

Is the difference between refs/heads/master and refs/for/master the problem? How do I set that up correctly?

You can use the push dialog, and check "Push to Gerrit". Then the plugin automatically uses the correct push target (should be refs/for/master).

Does that help?

No, that is not true. Look at this: Gerrit always defaults to origin (my GitHub fork on which I normally work), even though "Push to Gerrit" is active and the plugin has a preconfigured connection to the Eclipse Gerrit server and should use the gerrit remote or at least remember it when I selected it last time.

image

Then I am changing it normally in order to see a correct diff:

image

image

Still the push will go to origin.

Okay, that looks unexpected to me. Does anything change in the refs input when you toggle "Push to Gerrit" checkbox?

Yes, playing with the options, the refs input looks like this:

image

Trying to simply overwrite by the real branch ref...

image

yields

image

Overriding the branch in the Gerrit input field has no effect:

image

The edit box for the branch name still looks the same.

Okay, I could you please try removing the space from topic field (i.e. should be refs/for/master#wip,topic=Bug-573363)? I'd expect that this is a valid destination ref.

OK, that seems to do it:

image

Now also the branch name shows the full ref spec when not in edit mode.

But what is not so nice is that next time the push dialogue reverts to the name of my local branch, not remembering the value of the "Branch" input field:

image

If a destination ref containing spaces can be used when quoted, escaped or encoded somehow, please update the plugin in order to add that capability. Otherwise, please make sure that field validation kicks in in order to avoid users from entering something like "Bug xy" in the topic field.

Thank you for your quick support. Would you agree to leave this issue open until the two issues

  • remembering the last used remote branch name,
  • encoding spaces in topics or better validation

have been addressed and a new plugin release is available?

Thanks for your quick feedback. I'd appreciate if you could create two specific issues for these things, and close this one if you find the time.