Merge "Avoid double "error" prefix"
This commit is contained in:
commit
c18ef2b77a
|
@ -499,11 +499,8 @@ class ReceiveCommits {
|
|||
for (ValidationMessage m : messages) {
|
||||
String msg = m.getType().getPrefix() + m.getMessage();
|
||||
|
||||
if (m.isError()) {
|
||||
messageSender.sendError(msg);
|
||||
} else {
|
||||
messageSender.sendMessage(msg);
|
||||
}
|
||||
// Avoid calling sendError which will add its own error: prefix.
|
||||
messageSender.sendMessage(msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1553,6 +1553,22 @@ public abstract class AbstractPushForReview extends AbstractDaemonTest {
|
|||
pushForReviewOk(testRepo);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void errorMessageFormat() throws Exception {
|
||||
RevCommit c = createCommit(testRepo, "Message without Change-Id");
|
||||
assertThat(GitUtil.getChangeId(testRepo, c)).isEmpty();
|
||||
String ref = "refs/for/master";
|
||||
PushResult r = pushHead(testRepo, ref);
|
||||
RemoteRefUpdate refUpdate = r.getRemoteUpdate(ref);
|
||||
assertThat(refUpdate.getStatus()).isEqualTo(RemoteRefUpdate.Status.REJECTED_OTHER_REASON);
|
||||
String reason =
|
||||
String.format(
|
||||
"commit %s: missing Change-Id in message footer", c.toObjectId().abbreviate(7).name());
|
||||
assertThat(refUpdate.getMessage()).isEqualTo(reason);
|
||||
|
||||
assertThat(r.getMessages()).contains("\nERROR: " + reason);
|
||||
}
|
||||
|
||||
@Test
|
||||
@GerritConfig(name = "receive.allowPushToRefsChanges", value = "true")
|
||||
public void testPushWithChangedChangeId() throws Exception {
|
||||
|
|
Loading…
Reference in New Issue