Provide more informative error messages when rejecting updates

Bug: issue 1908
Change-Id: Idb83a5e085c3da2ebc30ee7b1a490d5e4a51b91b
This commit is contained in:
Matthew Dempsky 2013-05-08 15:02:33 -07:00
parent 32fdad39b2
commit 430835805a

View File

@ -1747,12 +1747,16 @@ public class ReceiveCommits {
eq(newCommit.getFullMessage(), priorCommit.getFullMessage());
final boolean parentsEq = parentsEqual(newCommit, priorCommit);
final boolean authorEq = authorEqual(newCommit, priorCommit);
final ObjectReader reader = rp.getRevWalk().getObjectReader();
if (messageEq && parentsEq && authorEq && !autoClose) {
addMessage(String.format(
"(W) No changes between prior commit %s and new commit %s",
reader.abbreviate(priorCommit).name(),
reader.abbreviate(newCommit).name()));
reject(inputCommand, "no changes made");
return false;
} else {
ObjectReader reader = rp.getRevWalk().getObjectReader();
StringBuilder msg = new StringBuilder();
msg.append("(W) ");
msg.append(reader.abbreviate(newCommit).name());