I've recently come across the following problem with chained commits in gerrit. To reproduce:
- Clone a test repository (tested with sandbox and gerrit-ping).
- Make a test patch that will be used as parent patch:
- git checkout -b parent && echo "foo" > testparent && git add -A && git commit -m "Parent patch" && git review
- Make another patch that depends on the previous one:
- git checkout -b child && echo "foo" > testchild && git add -A && git commit -m "Child patch" && git review
- Note the message that you're submitting multiple commits, type 'yes' and submit
- Go to the gerrit interface for the parent patch, make any edit using the UI (for example, change the testparent file from before), publish
- Locally, make sure you still have the child patch checked out, and that you do NOT have the newer version of the parent
- Make any change to that patch and try to push it:
- echo "bar" > testchild && git add -A && git commit --amend --no-edit && git review
- Note the message about submitting multiple commits, which has the older commit for the parent patch. Type 'yes' and submit.
This will fail with an error like:
The outstanding commits are: 95e5c35 (HEAD -> child) Child patch 97cd163 (parent) Parent patch Do you really want to submit the above commits? Type 'yes' to confirm, other to cancel: yes remote: remote: Processing changes: refs: 1 remote: Processing changes: refs: 1 remote: Processing changes: refs: 1, done To ssh://gerrit.wikimedia.org:29418/test/gerrit-ping ! [remote rejected] HEAD -> refs/for/master%topic=child (commit 97cd163e26 already exists in change 1167928) error: failed to push some refs to 'ssh://gerrit.wikimedia.org:29418/test/gerrit-ping'
I'm 100% sure this used to work before. I think previously it just detected that the parent commit is not the latest, and push the patch with an outdated dependency that I could then fix later. Since the gerrit-ping repo is currently set to use the "Merge If Necessary" strategy, this cannot be caused by the recent change to the default strategy. Thinking that it could be something on my local, I did a quick check and sure enough:
$ apt list --installed 2>/dev/null | fgrep git/ git/noble-updates,noble-security,now 1:2.43.0-1ubuntu7.3 amd64 [installed] $ fgrep "upgrade git:" /var/log/dpkg.log 2025-07-09 12:59:42 upgrade git:amd64 1:2.43.0-1ubuntu7.2 1:2.43.0-1ubuntu7.3
This looks suspicious, but checking the changelog, I don't immediately see anything that would make me suspect (unintended) consequences of a security fix. Also, I originally thought I'd seen this issue for more than just 24 hours (maybe like a week or so), but now I'm not so sure about it. At any rate, I tried downgrading to 1:2.43.0-1ubuntu7 and the problem is still there, so most likely it isn't that.
Also, if anyone else is having this issue: the workaround is to first download the parent patch locally, then re-do the push for the child patch. For just two patches it's probably OK, but for longer chains it can be quite annoying.