uwolfer / gerrit-intellij-plugin

Gerrit Code Review Tool Integration for the IntelliJ Platform
Apache License 2.0
495 stars 103 forks source link

Push to gerrit is pushing to branch instead of refs/for/<branch> #392

Closed dade-hms closed 2 years ago

dade-hms commented 4 years ago

We have a strange behavior here, the plugin pushed a commit as a normal push instead of as a review.

Situation:

editing a review that depends on 2 other reviews those reviews target a branch other than master committing and choosing "commit and push" in the push dialogs:

  1. the 3 review are visible,
  2. push to gerrit check box is pre-checked (didn't touch this box)
  3. the destination branch is preset to features/xyz from a previous push to gerrit which i don't change and is correct
  4. hashtags are preset and not changed I click on "push" and all 3 review are now marked as submitted in gerrit

In the version control logs on intellij i find:

 create mode 100644 view/src/main/angular/tsconfig.app.json
 create mode 100644 view/src/main/angular/tsconfig.json
 create mode 100644 view/src/main/angular/tsconfig.spec.json
17:24:14.361: [management-console] git -c credential.helper= -c core.quotepath=false -c log.showSignature=false push --progress --porcelain origin refs/heads/review/david_delbecq/1852:features/data-pricing-console
Enumerating objects: 146, done.
Delta compression using up to 8 threads
Total 144 (delta 33), reused 79 (delta 24)
remote: 
remote: Processing changes: refs: 1, closed: 1 (\)
remote: Processing changes: refs: 1, closed: 1 (|)
remote: Processing changes: refs: 1, closed: 1 (/)
remote: Processing changes: refs: 1, closed: 1 (-)
remote: Processing changes: refs: 1, closed: 1 (\)
remote: Processing changes: refs: 1, closed: 1 (\)
remote: Processing changes: refs: 1, closed: 1 (\)
remote: Processing changes: refs: 1, closed: 1, done            
To ssh://git.obfuscated/project/name
    refs/heads/review/david_delbecq/1852:refs/heads/features/xyz    cbc2cd9..2ae6c59

This behavior never happened before and happened twice this week. This might be related to the fact it's the first time we do both branch targeting, hashtags and chained reviews on the same review.

It looks like the checkbox "submit to gerrit" was prechecked by intellij in both occurences, but the model didn't match this value. Most of the time it's not prechecked and we have to manually check it.

intellij version: 2019.2.3 community edition gerrit plugin version: 1.2.2-146 gerrit version: 3.0.1

uwolfer commented 4 years ago

@dade-hms I've never seen this behavior. Can you please check the target branch info at the top of the dialog before you push your change? That target branch should update dynamically when you use the checkboxes or input lines of the plugins. It would help if you could check if the target branch in the UI is correct or not.

dade-hms commented 4 years ago

For that i can reply. Because it was the second time this occurred, I triple checked everything in UI before clicking the submit button. The target branch was correct, both at top (next to the 3 commits) and bottom. Note that it doesn't really tell a lot because the local branch was made to track that target branch so it would have been displayed on top too in case of a normal push.

benno-mueller-saxess commented 2 years ago

I think, we are facing the same topic.

The plugin generates the following command: git -c credential.helper= -c core.quotepath=false -c log.showSignature=false push --progress --porcelain origin refs/heads/current_local_branch:refs/heads/refs/for/master --set-upstream

It creates a remote branch Origin/refs/for/master instead of using the magical Gerrit branches. This happens when you push a local branch which has no tracked remote branch.

The consequence is that we cannot use the plugin for pushing and we have do pushing with a workaround by using commands in terminal. We like to use the plugin also for pushing because it is easier.

@uwolfer Can you fix this problem?

IntelliJ Version: 2021.3.1 Gerrit Plugin Version: 1.2.5-203 Gerrit Version: 3.3.4

uwolfer commented 2 years ago

@benno-mueller-saxess: Can you reproduce this issue all the time, or only randomly? Can you see what is wrong with the issued git push command?

benno-mueller-saxess commented 2 years ago

Hi @uwolfer I can reproduce it all the time.

Maybe it is an issue of IntelliJ itself (see https://youtrack.jetbrains.com/issue/IDEA-282180 )

uwolfer commented 2 years ago

@benno-mueller-saxess: The referenced issue should be available in the next release of IntelliJ - please report back if that resolves your issue.

benno-mueller-saxess commented 2 years ago

@uwolfer The issue is fixed by IntelliJ in Version 2021.3.3