missing Change-Id in commit message footer

554 views
Skip to first unread message

jo...@norricorp.f9.co.uk

unread,
May 12, 2017, 9:09:08 AM5/12/17
to Repo and Gerrit Discussion
Hi,
the commit-msg hook is installed in the local repo. And previous pushes to /refs/for/branch-name have worked fine.
But now this commit message
Author: John <email>
Date:   Fri May 12 13:53:45 2017 +0100

    new script gerritPush.sh
    issue #3

    Change-Id: I7bf3a767422c542a265c25e41eceb9ce88d83618

causes this error when pushed.
$ git push origin HEAD:refs/for/3-add-gerritpush-script
Counting objects: 11, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (5/5), 775 bytes | 0 bytes/s, done.
Total 5 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1)
remote: Processing changes: refs: 1, done
remote: ERROR: [4e5f009] missing Change-Id in commit message footer
remote:
remote: Hint: To automatically insert Change-Id, install the hook:
remote:   gitdir=$(git rev-parse --git-dir); scp -p -P 29418 user@machine:hooks/commit-msg ${gitdir}/hooks/
remote: And then amend the commit:
remote:   git commit --amend
remote:
To ssh://user@machine:29418/test3
 ! [remote rejected] HEAD -> refs/for/3-add-gerritpush-script ([4e5f009] missing Change-Id in commit message footer)
error: failed to push some refs to 'ssh://user@machine:29418/test3'

And from what I can see the change-id is in the last paragraph. And the commit message is same format as previous successfully pushed commits.

So what have I done wrong?

Regards,
John

Edwin Kempin

unread,
May 12, 2017, 9:11:44 AM5/12/17
to jo...@norricorp.f9.co.uk, Repo and Gerrit Discussion
Have you double-checked that the commit with SHA1 4e5f009 has a Change-Id?
Maybe you are looking at the wrong commit message?

 
error: failed to push some refs to 'ssh://user@machine:29418/test3'

And from what I can see the change-id is in the last paragraph. And the commit message is same format as previous successfully pushed commits.

So what have I done wrong?

Regards,
John

--
--
To unsubscribe, email repo-discuss+unsubscribe@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


John Norris

unread,
May 12, 2017, 9:30:24 AM5/12/17
to Edwin Kempin, Repo and Gerrit Discussion
Hi Edwin
good point. But I am looking at the right log output for the commit

But I have just realised what is going wrong. 
Rather than just sending the commit that I want sent, it is also sending a merge commit as well and this merge commit does not have a change id. And it should not have, the merge commit was done outside of gerrit. And so the push sends all of the commits, including the one on master that was the merge of a previous branch to master.

Regards

Dave Borowitz

unread,
May 12, 2017, 9:41:02 AM5/12/17
to John Norris, Edwin Kempin, Repo and Gerrit Discussion
This is actually one reason we have this check in the first place: it helps avoid accidentally creating new changes for commits you are accidentally copying from some other source.

--

Luca Milanesio

unread,
May 12, 2017, 9:47:28 AM5/12/17
to Dave Borowitz, John Norris, Edwin Kempin, Repo and Gerrit Discussion
This is a quite common scenario, people approaching Gerrit with a "GitHub or GitLab" pull-request mindset just try to do the same with Gerrit.

In GitHub (or GitLab) it would have worked, just "everything gets included" in the pull-request.
With Gerrit things are different, you start from a checkout, you do one commit and then push for review.

Possibly the messaging could be more explicit? It is all about wordings at the end of the day :-)

Luca.

To unsubscribe, email repo-discuss...@googlegroups.com

More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages