Always end the "Change-Id missing" error message with \n. This should fix the current output which looks like remote: ERROR: [5bfebfb] missing .. footerHint: to automatically .. Change-Id: Id555b98cccdc25faf2faf641f564692ced10e35d
diff --git a/java/com/google/gerrit/server/git/validators/CommitValidators.java b/java/com/google/gerrit/server/git/validators/CommitValidators.java index e4c7b35..6cc6eb5 100644 --- a/java/com/google/gerrit/server/git/validators/CommitValidators.java +++ b/java/com/google/gerrit/server/git/validators/CommitValidators.java
@@ -333,14 +333,14 @@ private CommitValidationMessage getMissingChangeIdErrorMsg(String errMsg, RevCommit c) { StringBuilder sb = new StringBuilder(); - sb.append("ERROR: ").append(errMsg); + sb.append("ERROR: ").append(errMsg).append("\n"); boolean hinted = false; if (c.getFullMessage().contains(CHANGE_ID_PREFIX)) { String lastLine = Iterables.getLast(Splitter.on('\n').split(c.getFullMessage()), ""); if (!lastLine.contains(CHANGE_ID_PREFIX)) { hinted = true; - sb.append("\n\n") + sb.append("\n") .append("Hint: run\n") .append(" git commit --amend\n") .append("and move 'Change-Id: Ixxx..' to the bottom on a separate line\n"); @@ -349,7 +349,7 @@ // Print only one hint to avoid overwhelming the user. if (!hinted) { - sb.append("Hint: to automatically insert a Change-Id, install the hook:\n") + sb.append("\nHint: to automatically insert a Change-Id, install the hook:\n") .append(getCommitMessageHookInstallationHint()) .append("\n") .append("and then amend the commit:\n")