Parse body when creating CommitResource

GetCommit depends on the body of both the commit and parent being
parsed, to get the subject.

Change-Id: Ic33854a129926e4138e21a57e9218969486720be
This commit is contained in:
Dave Borowitz
2014-08-08 13:26:37 -07:00
parent 62d0a15324
commit 68bb9055cf

View File

@@ -70,11 +70,12 @@ public class CommitsCollection implements
RevWalk rw = new RevWalk(repo);
try {
RevCommit commit = rw.parseCommit(objectId);
rw.parseBody(commit);
if (!parent.getControl().canReadCommit(db.get(), rw, commit)) {
throw new ResourceNotFoundException(id);
}
for (int i = 0; i < commit.getParentCount(); i++) {
rw.parseCommit(commit.getParent(i));
rw.parseBody(rw.parseCommit(commit.getParent(i)));
}
return new CommitResource(parent, commit);
} catch (MissingObjectException | IncorrectObjectTypeException e) {