Page MenuHomePhabricator

[upstream] Gerrit does not recognize a commit it should already have
Closed, DeclinedPublic

Description

Hello,

I am trying to maintain our own copy of Composer ( http://github.com/composer/composer ) in a Gerrit repository integration/composer.git which would be used for deployments.

The workflow I envision is:

  • a branch 'upstream' which is a copy of composer master branch
  • a branch 'master' in which we merge upstream tags then update the dependencies and create an additional commit containing the dependencies.

When tagging a new version, upstream creates a commit which is not in their master branch and tag it. Their latest tag 1.0.0-alpha8 is an annotated tag.

When I push my merge commit to refs/for/master Gerrit complains because the commit pointed to the tag does not contain a Change-Id. Since I pushed to Gerrit the tag, it should already know both the annotated tag and the commit object it points to. It sounds like a bug in Gerrit to me.

How to reproduce:

git clone ssh://gerrit.wikimedia.org:29418/integration/composer
cd composer

The master branch only has a .gitreview file.

We have local tags:

$ git tag
1.0.0-alpha1
1.0.0-alpha2
1.0.0-alpha3
1.0.0-alpha4
1.0.0-alpha5
1.0.0-alpha6
1.0.0-alpha7
1.0.0-alpha8
$

And Gerrit has the tags:

$ git ls-remote origin refs/tags/*
fd9fb49cdd80692dc3ba3709275426cea35b1471 refs/tags/1.0.0-alpha1
a2a060752be8cb69b6992ad2df982b512b1bc432 refs/tags/1.0.0-alpha2
b28b76f34b94cf116b8af5dcc8585074d4f02ffc refs/tags/1.0.0-alpha3
2880cb628f1fd3ee0817419b2fc27fff6a46968f refs/tags/1.0.0-alpha4
d2ca1a4ef6d728a4ae8eb0b4ac5c37439d85fadb refs/tags/1.0.0-alpha5
0c8158f47d7dda89226d4e816fee1fb9ac6c1204 refs/tags/1.0.0-alpha6
3e6afd8975b6ff6eb3045ba00e532d6c0e302fe6 refs/tags/1.0.0-alpha7
22c43685024d04d491985caae930b0b3fdc3a30c refs/tags/1.0.0-alpha8
1eb1df44a97fb2daca1bb8b007f3bee012f0aa46 refs/tags/1.0.0-alpha8^{}
$

Now I want to merge in 1.0.0-alpha8 to our master branch:

My master branch now looks like:

$ git log --oneline --decorate --graph -n 5

  • 7655c59 (HEAD, master) Merge tag '1.0.0-alpha8'
\
* 1eb1df4 (tag: 1.0.0-alpha8) Release 1.0.0-alpha8
* fd297bc Update changelog
* 7ad2d95 Update deps
* bc153ea Clean up var name
<...>
  • 9e585ee (origin/master, origin/HEAD) Initial commit

I then attempt to propose my merge commit for review:

$ git push origin master:refs/for/master
Counting objects: 12, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (2/2), 309 bytes | 0 bytes/s, done.
Total 2 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1)
remote: Processing changes: refs: 1, done
remote: ERROR: missing Change-Id in commit message footer
remote: Suggestion for commit message:
remote: Release 1.0.0-alpha8
remote:
remote: Change-Id: I1eb1df44a97fb2daca1bb8b007f3bee012f0aa46
remote:
remote: Hint: To automatically insert Change-Id, install the hook:
remote: gitdir=$(git rev-parse --git-dir); scp -p -P 29418 hashar@gerrit.wikimedia.org:hooks/commit-msg ${gitdir}/hooks/
remote:
remote:
To ssh://gerrit.wikimedia.org:29418/integration/composer
! [remote rejected] master -> refs/for/master (missing Change-Id in commit message footer)
error: failed to push some refs to 'ssh://gerrit.wikimedia.org:29418/integration/composer'
$

So although Gerrit has the tag object and the commit it points to:

22c43685024d04d491985caae930b0b3fdc3a30c refs/tags/1.0.0-alpha8
1eb1df44a97fb2daca1bb8b007f3bee012f0aa46 refs/tags/1.0.0-alpha8^{}

It bails out.

I thought git push --tags only push the references and does not push the target objects. But giblit seems to know boths suggesting Gerrit has both objects:

https://git.wikimedia.org/commit/integration%2Fcomposer/1eb1df44a97fb2daca1bb8b007f3bee012f0aa46
https://git.wikimedia.org/commit/integration%2Fcomposer/22c43685024d04d491985caae930b0b3fdc3a30c

I think there is a failure in Gerrit logic which can not find one of the two object, possibly because it is an annotated tag.

Extended git log:

  • commit 8274b97c2738bb540a04cc8335218aaf4f2d97aa (HEAD, master)
\ Merge: 9e585ee 1eb1df4
Author: Antoine Musso <hashar@free.fr>
Date: Tue Mar 25 11:07:57 2014 +0100
Merge upstream tag '1.0.0-alpha8'
Release 1.0.0-alpha8
Change-Id: I887a0f505aa866134cae59ef6f4c3270a5daaa47
* commit 1eb1df44a97fb2daca1bb8b007f3bee012f0aa46 (tag: 1.0.0-alpha8)
Author: Jordi Boggiano <j.boggiano@seld.be>
Date: Mon Jan 6 19:39:59 2014 +0100
Release 1.0.0-alpha8
* commit fd297bce9222eea72ab7717b5621414aceefab6a
Author: Jordi Boggiano <j.boggiano@seld.be>
Date: Mon Jan 6 19:37:30 2014 +0100
Update changelog

Shows that 1eb1df44a97fb2daca1bb8b007f3bee012f0aa46 is indeed missing a Change-Id but since Gerrit has it it should not complain about it :-D


Version: wmf-deployment
Severity: normal

Details

Reference
bz63067