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
diff --git a/Documentation/error-invalid-changeid-line.txt b/Documentation/error-invalid-changeid-line.txt
index 2f57542..9235266 100644
--- a/Documentation/error-invalid-changeid-line.txt
+++ b/Documentation/error-invalid-changeid-line.txt
@@ -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
-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
by doing a link:http://www.kernel.org/pub/software/scm/git/docs/git-log.html[git log].
diff --git a/Documentation/error-messages.txt b/Documentation/error-messages.txt
index c9df883..af230e2 100644
--- a/Documentation/error-messages.txt
+++ b/Documentation/error-messages.txt
@@ -16,10 +16,10 @@
* link:error-contains-banned-commit.html[contains banned commit ...]
* link:error-has-duplicates.html[... has duplicates]
* 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-missing-changeid.html[missing Change-Id in commit message]
-* link:error-multiple-changeid-lines.html[multiple Change-Id lines 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 footer]
* link:error-no-changes-made.html[no changes made]
* link:error-no-common-ancestry.html[no common ancestry]
* link:error-no-new-changes.html[no new changes]
@@ -27,7 +27,7 @@
* 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-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-change-upload-blocked.html[One or more refs/for/ names blocks change upload]
* link:error-permission-denied.html[Permission denied (publickey)]
diff --git a/Documentation/error-missing-changeid.txt b/Documentation/error-missing-changeid.txt
index daa1d46..b13f3b4 100644
--- a/Documentation/error-missing-changeid.txt
+++ b/Documentation/error-missing-changeid.txt
@@ -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
which is configured to always require a Change-Id in the commit
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:
diff --git a/Documentation/error-multiple-changeid-lines.txt b/Documentation/error-multiple-changeid-lines.txt
index e604974..9fa2b91 100644
--- a/Documentation/error-multiple-changeid-lines.txt
+++ b/Documentation/error-multiple-changeid-lines.txt
@@ -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
-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
by doing a link:http://www.kernel.org/pub/software/scm/git/docs/git-log.html[git log].
diff --git a/Documentation/error-not-signed-off-by.txt b/Documentation/error-not-signed-off-by.txt
index 00f179b..bd1f40d 100644
--- a/Documentation/error-not-signed-off-by.txt
+++ b/Documentation/error-not-signed-off-by.txt
@@ -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
-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
-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.
This policy can be bypassed by having the access right
@@ -13,11 +13,11 @@
This error may happen for different reasons if you do not have the
access right to forge the committer identity:
-. missing Signed-off-by in the commit message
-. Signed-off-by is contained in the commit message but it's neither
+. missing Signed-off-by in the commit message footer
+. Signed-off-by is contained in the commit message footer but it's neither
from the author, committer nor uploader
. 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
messages as explained link:error-push-fails-due-to-commit-message.html[here] so that they contain a Signed-off-by from
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/git/ReceiveCommits.java b/gerrit-server/src/main/java/com/google/gerrit/server/git/ReceiveCommits.java
index 4e5dd2b..afa4704 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/git/ReceiveCommits.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/git/ReceiveCommits.java
@@ -1969,7 +1969,7 @@
}
}
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;
}
}
@@ -1978,19 +1978,19 @@
if (MagicBranch.isMagicBranch(cmd.getRefName()) || NEW_PATCHSET.matcher(cmd.getRefName()).matches()) {
if (idList.isEmpty()) {
if (projectControl.getProjectState().isRequireChangeID()) {
- String errMsg = "missing Change-Id in commit message";
+ String errMsg = "missing Change-Id in commit message footer";
reject(cmd, errMsg);
addMessage(getFixedCommitMsgWithChangeId(errMsg, c));
return false;
}
} 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;
} else {
final String v = idList.get(idList.size() - 1).trim();
if (!v.matches("^I[0-9a-f]{8,}.*$")) {
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);
addMessage(getFixedCommitMsgWithChangeId(errMsg, c));
return false;