From 014b0e8973361d00bf46f5be2fff6c501867219f Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Thu, 5 Jul 2018 16:33:02 +0200 Subject: [PATCH] Clean up Change-Id hint text Before: remote: ERROR: [c3dcb3a] ... remote: remote: Hint: A potential Change-Id was found, but it was not in the footer (last paragraph) of the commit message. remote: After: remote: ERROR: [a1a077b] ... remote: remote: Hint: run remote: git commit --amend remote: and move 'Change-Id: Ixxx..' to the bottom on a separate line Change-Id: I57387d88c7f105a33ede17ef76a4ac1f064fefdd --- .../gerrit/server/git/validators/CommitValidators.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/java/com/google/gerrit/server/git/validators/CommitValidators.java b/java/com/google/gerrit/server/git/validators/CommitValidators.java index 57786a6974..ec2d848feb 100644 --- a/java/com/google/gerrit/server/git/validators/CommitValidators.java +++ b/java/com/google/gerrit/server/git/validators/CommitValidators.java @@ -338,12 +338,10 @@ public class CommitValidators { if (c.getFullMessage().contains(CHANGE_ID_PREFIX)) { String lastLine = Iterables.getLast(Splitter.on('\n').split(c.getFullMessage()), ""); if (!lastLine.contains(CHANGE_ID_PREFIX)) { - sb.append('\n'); - sb.append('\n'); - sb.append("Hint: A potential "); - sb.append(FooterConstants.CHANGE_ID.getName()); - sb.append(" was found, but it was not in the "); - sb.append("footer (last paragraph) of the commit message."); + sb.append("\n\n") + .append("Hint: run\n") + .append(" git commit --amend\n") + .append("and move 'Change-Id: Ixxx..' to the bottom on a separate line\n"); } } sb.append('\n');