Files
gerrit/Documentation/error-changeid-above-footer.txt
Jonathan Nieder 1063e30c58 Reject changes with Change-Id above footer
Documentation/user-change-id.txt explains:

	To be picked up by Gerrit, a Change-Id line must be in the
	footer (last paragraph) of a commit message, and may be mixed
	together with Signed-off-by, Acked-by, or other such lines.

It is easy to forget to do that, producing a commit message like

	Do something great

	Change-Id: I55ca6286e3e4f4fba5d0448333fa99fc5a404a73

	Bug: 12345

Because of the blank line between the Change-Id and other trailer
line, the Change-Id is not picked up by Gerrit.  Worse, if the
repository is configured with "Require Change-Id in commit message"
set to false, then Gerrit comes up with its own change-id for the
change.  If I amend my commit in response to review comments and push
for review again, Gerrit comes up with another change-id, so my
amended version of the change shows up as a new change.

This sequence of events can be avoided by setting "Require Change-Id"
to true, but some projects like to review changes from upstreams that
don't use Gerrit.  Fortunately, even these projects don't need changes
with a Change-Id before the footer.  Treat them as an error
unconditionally, with the same advice to the user about how to clean up
that is already shown in Require Change-Id mode:

	ERROR: Change-Id must be in message footer

	Hint: run
	  git commit --amend
	and move 'Change-Id: Ixxx..' to the bottom on a separate line

As a side benefit, treating this as its own error type also allows
simplifying the error reporting for changes with no Change-Id.

Reported-by: Paul Crowley <paulcrowley@google.com>
Change-Id: Ia5d43370e075d6fc13cd9b22031436f1138e90c0
2019-04-02 22:51:38 -07:00

32 lines
1.2 KiB
Plaintext

= commit xxxxxxx: Change-Id must be in message footer
With this error message, Gerrit rejects a push of a commit to a project
if the commit message of the pushed commit contains a Change-Id line that
is not in the footer (the last paragraph).
To be picked up by Gerrit, a Change-Id must be in the last paragraph
of a commit message. For details, see link:user-changeid.html[Change-Id Lines].
You can see the commit messages for existing commits in the history
by doing a link:http://www.kernel.org/pub/software/scm/git/docs/git-log.html[git log].
== Change-Id is contained in the commit message but not in the last paragraph
If the Change-Id is contained in the commit message but not in its
last paragraph, you have to update the commit message and move the
Change-Id into the last paragraph. How to update the commit message
is explained link:error-push-fails-due-to-commit-message.html[here].
To avoid confusion due to a Change-Id that was meant to be picked up by
Gerrit not being picked up, this is an error whether or not the project
is configured to always require a Change-Id in the commit message.
GERRIT
------
Part of link:error-messages.html[Gerrit Error Messages]
SEARCHBOX
---------