Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Gerrit, how can I prevent a patch set from being submitted that is not completely up-to-date?

Two developers are working on the develop branch on two entirely different changes (say, two different files). They both submit their work at the same time, triggering two Jenkins builds. Those builds go fine but one review takes longer than the other.

The first dev submits their patch set and there are no intermediate commits on develop so Gerrit merges it right in.

The second dev later submits their patch set. Though there's an intermediate commit now, the merge itself is trivial and Gerrit performs the merge.

Now we have two builds, neither of which contains the work of the other.

I'd like to block the second submission if there are any intermediate commits, even if the merge would be totally trivial, causing the developer to instead rebase and update their submission (and trigger a new build in Jenkins in the process).

What do I set in Gerrit to block such trivial-but-unwanted merges when a review is complete, the patch set is being submitted but the target branch has intermediate merges on it?

like image 415
MartyMacGyver Avatar asked Dec 07 '12 02:12

MartyMacGyver


1 Answers

You can change project options in Gerrit To fast-forward only, This would prevent the change from going in as it is not a fast forward merge. Then forcing developer2 to git pull --rebase and push again, now the change that developer1 did will be part of the verification.

like image 108
Rasmus Østergaard Kjær Voss Avatar answered Sep 21 '22 16:09

Rasmus Østergaard Kjær Voss