On Jan 11, 2011, at 4:14 AM, Dmitry Fink wrote:
>
> Steps to reproduce the problem:
> 1. Create commit locally
> 2. Push it for review to refs/for
> 3. Abandon the commit in gerrit
> 4. Push same HEAD to refs/heads/test_branch
>
> Gerrit is detecting that commit corresponds to a change, tries to
> close that change (adds a comment, send emails) however fails to set
> the status to MERGED, my guess is the reason for failing to update is
> some last minute check that verifies that the change is "open", and
> ABANDONED is no "open", so update to MERGED fails.
>
I've observed the following in Gerrit 2.1.6.1, I think it's the same root issue. We use shared feature branches for development occasionally, and rather than maintaining a second git "hub", I've set gerrit to allow developers to push to refs/heads/feature/*. We use a branch called "develop" instead of "master", and the gerrit host is set up as "origin".
Steps to reproduce:
1. git checkout develop
2. git checkout -b feature/bogus-feature
3. echo "bogus change" > test.txt && git add test.txt && git commit -m 'added bogus.txt , ignore this'
5. git log
commit c0a9b29d89faf1bea0791a6dff60618f9d326dc2
Author: Erik S. LaBianca <erik.l...@gmail.com>
Date: Tue Jan 11 09:48:24 2011 -0500
adding a bogus change, ignore it
Change-Id: Idfd820808ddb47c91e5c516dcc7f4dc4aa641028
4. git push origin HEAD:refs/for/develop
5. observe review is created successfully in gerrit
6. git push origin feature/bogus-feature
7. observe gerrit flipped the submitted changeset to "merged" and added a comment:
Change has been successfully pushed into branch feature/bogus-feature.
So, at least in my case, I think the bug here is pretty straightforward. Wherever in the code watches for inbound changes to refs/heads*, it is not sufficiently discriminating in matching branches and instead sees a forced push to a branch with the same sha of the changeset and assumes it must be a manual merge.
Hope this helps.
Thanks
--erik
In fact, it's not doing this because of the similar SHA1, but because the commit message has a Change-Id that matches an existing Change-Id in Gerrit.
If you do a 'git commit --amend' before you push it to the feature branch and remove the Change-Id line from the commit message, it won't transition your change to Merged, even though it is the same SHA1 you're pushing.
We use this procedure here, it works well.
Luciano.
In fact, it's not doing this because of the similar SHA1, but because the commit message has a Change-Id that matches an existing Change-Id in Gerrit.
If you do a 'git commit --amend' before you push it to the feature branch and remove the Change-Id line from the commit message, it won't transition your change to Merged, even though it is the same SHA1 you're pushing.
We use this procedure here, it works well.
I can't promise anything, but since it bugs me and I'd like to help out I'd like to make a pass at resolving it.
--erik
Dmitry,
I don't think it matches it at all, because when people cherry-pick the SHA1 changes, and the only matching thing is the change-id line, the change is going to move to ready.
Another test you can do is to disable the commit-message hook and create a commit, push it to refs/for, (make sure it doesn't have the commit-id line), then push it directly to a different branch head. It won't move the change to Merged.
Regards,
Luciano
I meant: "move to Merged" in the first paragraph.
Another test you can do is to disable the commit-message hook and create a commit, push it to refs/for, (make sure it doesn't have the commit-id line), then push it directly to a different branch head. It won't move the change to Merged.