ReceiveCommits: Parse body before accessing full commit message

Change-Id: I49e57e82e8d7de941a0e2e6a827cda1a2aa303eb
This commit is contained in:
Dave Borowitz
2018-12-04 15:32:07 -08:00
committed by David Pursehouse
parent 36f8941818
commit 73a922fd6f

View File

@@ -2712,10 +2712,13 @@ class ReceiveCommits {
/** prints a warning if the new PS has the same tree as the previous commit. */
private void sameTreeWarning() throws IOException {
RevCommit newCommit = receivePack.getRevWalk().parseCommit(newCommitId);
RevWalk rw = receivePack.getRevWalk();
RevCommit newCommit = rw.parseCommit(newCommitId);
RevCommit priorCommit = revisions.inverse().get(priorPatchSet);
if (newCommit.getTree().equals(priorCommit.getTree())) {
rw.parseBody(newCommit);
rw.parseBody(priorCommit);
boolean messageEq =
Objects.equals(newCommit.getFullMessage(), priorCommit.getFullMessage());
boolean parentsEq = parentsEqual(newCommit, priorCommit);