Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Submit patch in gerrit without parents

Tags:

git

patch

gerrit

I'm currently setting up a gerrit server in my new company. I used to use gerrit for few years now but I never setup one.

I installed gerrit 2.13.5 and I'm trying to configure it. I have two last issues I'm trying to fix (I'll only discuss one here).

I have a list of commits A->B->C

A is the parent of B, B is the parent of C

  • Someone reject (-2) my patch A and B (because they're bad) but accept C (+2).
  • C is completly unrelated to A and B (another file in another folder into my project)

A button "Submit including parents" appears to my commit C but I cannot cherry-pick it into gerrit/master branch since A and B are reject.

Since C is not related to A or B, but I don't want to have to much local branches, I've done all 3 commits into the same branch.

I use cherry-pick submit option into gerrit configuration

[submit]
action = cherry pick
mergeContent = true

I supposed that using this option, I could cherry-pick any commits with no direct parents dependencies. I used to do so in my previous company but I cannot succeed to setup gerrit this way here.

If anyone have ideas or questions I will really by please to get or answer it.

Cheers.

like image 565
Hervé CUCHE Avatar asked Jun 30 '26 21:06

Hervé CUCHE


2 Answers

I've a very little different version of Gerrit (2.13.6) and I've tried to reproduce the issue here. I've found the following:

  1. If the project strategy is "Cherry Pick", the button shows "Submit"

enter image description here

  1. If the project strategy is any other option, the button shows "Submit including parents"

enter image description here

Using the first option it was possible to submit the second commit before the first one without issues.

So, I think is a good idea to check if you really have the strategy "Cherry Pick" set for your specific project. If the "Cherry Pick" strategy is correctly set then you could try to update for the last available version (2.13.7).

like image 125
Marcelo Ávila de Oliveira Avatar answered Jul 03 '26 02:07

Marcelo Ávila de Oliveira


There is one more possibility irrespective of your project startegy in this case.

  • Click Rebase button.
  • Check the option Change parent revision
  • Input the git's sha-id of any un-submitted change on the branch you may want to rebase on or the HEAD commit of the branch.

This will create a new patch set for the change. Reviews will have to be done again and also verifies will execute again. Although this is not a direct submission, this can help if you do not have gerrit server setup rights.

like image 42
Mukund Jalan Avatar answered Jul 03 '26 01:07

Mukund Jalan