Git cherry-pick, merge and revert (including the Gerrit button) do not include Change-Id in commit message

Bug #1200215 reported by Mark McLoughlin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Core Infrastructure
Won't Fix
Medium
Unassigned

Bug Description

I used the gerrit revert button for this: https://review.openstack.org/#/c/36605/

You see in Patch Set 1, gerrit didn't include a Change-Id in the commit message

So, when I had to rebase (which was odd, there was no conflicts) I needed to manually add the Change-Id

Revision history for this message
Jeremy Stanley (fungi) wrote :

I hadn't noticed that button existed, but the obvious workaround here (for those stumbling across this bug) is merely to revert locally and then propose that change for review, since the commit hook should add a Change Id header for you.

Chances are this is an upstream bug, and likely fixed since the 2.4 release we're running. If someone gets a chance to see whether there's a patch we can easily backport for this it would be appreciated!

Changed in openstack-ci:
status: New → Triaged
importance: Undecided → Medium
Revision history for this message
Clark Boylan (cboylan) wrote :

It is worth noting that the Change Id hook that git review installs will not add a Change Id to revert commits. Instead what you can git is `git revert` then `git commit --amend` which will cause the hook to run and add a Change Id.

Revision history for this message
Jeremy Stanley (fungi) wrote :

After some thorough research, I see why this is the way it is. Not all git subcommands which create or update the commit message go through the same code paths and most (aside from git commit) cannot safely trigger this hook.

http://git.661346.n2.nabble.com/git-revert-doesn-t-run-commit-msg-hook-td7559622.html

http://git.661346.n2.nabble.com/cherry-pick-pre-commit-hook-td5815961.html

There are other hooks which could be used for some of these, but only by for example embedding the change-id into the commit message template and requiring the user to uncomment it by explicitly amending that commit. I found nothing which was any easier or less confusing than the current workarounds.

summary: - Gerrit revert does not include Change-Id in commit message
+ Gerrit cherry-pick, merge and revert do not include Change-Id in commit
+ message
Changed in openstack-ci:
status: Triaged → Won't Fix
summary: - Gerrit cherry-pick, merge and revert do not include Change-Id in commit
- message
+ Git cherry-pick, merge and revert (including the Gerrit button) do not
+ include Change-Id in commit message
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.