Clarify error messages related to commit message footer content
Commits can be rejected due to the following issues in the commit message: - Change-Id tag is missing or incorrectly formatted - Multiple Change-Id tags are present - Signed-off-by tag is missing or does not specify the correct user However the error messages raised in these cases do not make it clear that the required tags are expected to be found in the footer (last paragraph) of the commit message. Update the error messages and related documentation to explicitly mention that the tags should be in the commit message footer. Change-Id: I7d2d2dfb66bed3697745733c4fe19c177e9bc56b
This commit is contained in:
parent
959f96e0a0
commit
a68769eb4f
@ -1,8 +1,8 @@
|
|||||||
invalid Change-Id line format in commit message
|
invalid Change-Id line format in commit message footer
|
||||||
===============================================
|
======================================================
|
||||||
|
|
||||||
With this error message Gerrit rejects to push a commit if its commit
|
With this error message Gerrit rejects to push a commit if its commit
|
||||||
message contains an invalid Change-Id line.
|
message footer contains an invalid Change-Id line.
|
||||||
|
|
||||||
You can see the commit messages for existing commits in the history
|
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].
|
by doing a link:http://www.kernel.org/pub/software/scm/git/docs/git-log.html[git log].
|
||||||
|
@ -16,10 +16,10 @@ Error Messages
|
|||||||
* link:error-contains-banned-commit.html[contains banned commit ...]
|
* link:error-contains-banned-commit.html[contains banned commit ...]
|
||||||
* link:error-has-duplicates.html[... has duplicates]
|
* link:error-has-duplicates.html[... has duplicates]
|
||||||
* link:error-invalid-author.html[invalid author]
|
* link:error-invalid-author.html[invalid author]
|
||||||
* link:error-invalid-changeid-line.html[invalid Change-Id line format in commit message]
|
* link:error-invalid-changeid-line.html[invalid Change-Id line format in commit message footer]
|
||||||
* link:error-invalid-committer.html[invalid committer]
|
* link:error-invalid-committer.html[invalid committer]
|
||||||
* link:error-missing-changeid.html[missing Change-Id in commit message]
|
* link:error-missing-changeid.html[missing Change-Id in commit message footer]
|
||||||
* link:error-multiple-changeid-lines.html[multiple Change-Id lines in commit message]
|
* link:error-multiple-changeid-lines.html[multiple Change-Id lines in commit message footer]
|
||||||
* link:error-no-changes-made.html[no changes made]
|
* link:error-no-changes-made.html[no changes made]
|
||||||
* link:error-no-common-ancestry.html[no common ancestry]
|
* link:error-no-common-ancestry.html[no common ancestry]
|
||||||
* link:error-no-new-changes.html[no new changes]
|
* link:error-no-new-changes.html[no new changes]
|
||||||
@ -27,7 +27,7 @@ Error Messages
|
|||||||
* link:error-not-a-gerrit-administrator.html[Not a Gerrit administrator]
|
* link:error-not-a-gerrit-administrator.html[Not a Gerrit administrator]
|
||||||
* link:error-not-a-gerrit-project.html[not a Gerrit project]
|
* link:error-not-a-gerrit-project.html[not a Gerrit project]
|
||||||
* link:error-not-permitted-to-create.html[Not permitted to create ...]
|
* link:error-not-permitted-to-create.html[Not permitted to create ...]
|
||||||
* link:error-not-signed-off-by.html[not Signed-off-by author/committer/uploader]
|
* link:error-not-signed-off-by.html[not Signed-off-by author/committer/uploader in commit message footer]
|
||||||
* link:error-not-valid-ref.html[not valid ref]
|
* link:error-not-valid-ref.html[not valid ref]
|
||||||
* link:error-change-upload-blocked.html[One or more refs/for/ names blocks change upload]
|
* link:error-change-upload-blocked.html[One or more refs/for/ names blocks change upload]
|
||||||
* link:error-permission-denied.html[Permission denied (publickey)]
|
* link:error-permission-denied.html[Permission denied (publickey)]
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
missing Change-Id in commit message
|
missing Change-Id in commit message footer
|
||||||
===================================
|
==========================================
|
||||||
|
|
||||||
With this error message Gerrit rejects to push a commit to a project
|
With this error message Gerrit rejects to push a commit to a project
|
||||||
which is configured to always require a Change-Id in the commit
|
which is configured to always require a Change-Id in the commit
|
||||||
message if the commit message of the pushed commit does not contain
|
message if the commit message of the pushed commit does not contain
|
||||||
a Change-Id.
|
a Change-Id in the footer (the last paragraph).
|
||||||
|
|
||||||
This error may happen for two reasons:
|
This error may happen for two reasons:
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
multiple Change-Id lines in commit message
|
multiple Change-Id lines in commit message footer
|
||||||
==========================================
|
=================================================
|
||||||
|
|
||||||
With this error message Gerrit rejects to push a commit if the commit
|
With this error message Gerrit rejects to push a commit if the commit
|
||||||
message of the pushed commit contains several Change-Id lines.
|
message footer of the pushed commit contains several Change-Id lines.
|
||||||
|
|
||||||
You can see the commit messages for existing commits in the history
|
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].
|
by doing a link:http://www.kernel.org/pub/software/scm/git/docs/git-log.html[git log].
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
not Signed-off-by author/committer/uploader
|
not Signed-off-by author/committer/uploader in commit message footer
|
||||||
===========================================
|
====================================================================
|
||||||
|
|
||||||
Projects in Gerrit can be configured to require a link:user-signedoffby.html#Signed-off-by[Signed-off-by] in
|
Projects in Gerrit can be configured to require a link:user-signedoffby.html#Signed-off-by[Signed-off-by] in
|
||||||
the commit message to enforce that every change is signed by the
|
the footer of the commit message to enforce that every change is signed by the
|
||||||
author, committer or uploader. If for a project a Signed-off-by is
|
author, committer or uploader. If for a project a Signed-off-by is
|
||||||
required and the commit message does not contain it, Gerrit rejects
|
required and the commit message footer does not contain it, Gerrit rejects
|
||||||
to push the commit with this error message.
|
to push the commit with this error message.
|
||||||
|
|
||||||
This policy can be bypassed by having the access right
|
This policy can be bypassed by having the access right
|
||||||
@ -13,11 +13,11 @@ link:access-control.html#category_forge_committer['Forge Committer'].
|
|||||||
This error may happen for different reasons if you do not have the
|
This error may happen for different reasons if you do not have the
|
||||||
access right to forge the committer identity:
|
access right to forge the committer identity:
|
||||||
|
|
||||||
. missing Signed-off-by in the commit message
|
. missing Signed-off-by in the commit message footer
|
||||||
. Signed-off-by is contained in the commit message but it's neither
|
. Signed-off-by is contained in the commit message footer but it's neither
|
||||||
from the author, committer nor uploader
|
from the author, committer nor uploader
|
||||||
. Signed-off-by from the author, committer or uploader is contained
|
. Signed-off-by from the author, committer or uploader is contained
|
||||||
in the commit message but not in the last paragraph
|
in the commit message but not in the footer (last paragraph)
|
||||||
|
|
||||||
To be able to push your commits you have to update the commit
|
To be able to push your commits you have to update the commit
|
||||||
messages as explained link:error-push-fails-due-to-commit-message.html[here] so that they contain a Signed-off-by from
|
messages as explained link:error-push-fails-due-to-commit-message.html[here] so that they contain a Signed-off-by from
|
||||||
|
@ -1969,7 +1969,7 @@ public class ReceiveCommits {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!sboAuthor && !sboCommitter && !sboMe && !ctl.canForgeCommitter()) {
|
if (!sboAuthor && !sboCommitter && !sboMe && !ctl.canForgeCommitter()) {
|
||||||
reject(cmd, "not Signed-off-by author/committer/uploader");
|
reject(cmd, "not Signed-off-by author/committer/uploader in commit message footer");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1978,19 +1978,19 @@ public class ReceiveCommits {
|
|||||||
if (MagicBranch.isMagicBranch(cmd.getRefName()) || NEW_PATCHSET.matcher(cmd.getRefName()).matches()) {
|
if (MagicBranch.isMagicBranch(cmd.getRefName()) || NEW_PATCHSET.matcher(cmd.getRefName()).matches()) {
|
||||||
if (idList.isEmpty()) {
|
if (idList.isEmpty()) {
|
||||||
if (projectControl.getProjectState().isRequireChangeID()) {
|
if (projectControl.getProjectState().isRequireChangeID()) {
|
||||||
String errMsg = "missing Change-Id in commit message";
|
String errMsg = "missing Change-Id in commit message footer";
|
||||||
reject(cmd, errMsg);
|
reject(cmd, errMsg);
|
||||||
addMessage(getFixedCommitMsgWithChangeId(errMsg, c));
|
addMessage(getFixedCommitMsgWithChangeId(errMsg, c));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (idList.size() > 1) {
|
} else if (idList.size() > 1) {
|
||||||
reject(cmd, "multiple Change-Id lines in commit message");
|
reject(cmd, "multiple Change-Id lines in commit message footer");
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
final String v = idList.get(idList.size() - 1).trim();
|
final String v = idList.get(idList.size() - 1).trim();
|
||||||
if (!v.matches("^I[0-9a-f]{8,}.*$")) {
|
if (!v.matches("^I[0-9a-f]{8,}.*$")) {
|
||||||
final String errMsg =
|
final String errMsg =
|
||||||
"missing or invalid Change-Id line format in commit message";
|
"missing or invalid Change-Id line format in commit message footer";
|
||||||
reject(cmd, errMsg);
|
reject(cmd, errMsg);
|
||||||
addMessage(getFixedCommitMsgWithChangeId(errMsg, c));
|
addMessage(getFixedCommitMsgWithChangeId(errMsg, c));
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user