public RevCommit build() {
if (treeId == null) {
throw new IllegalStateException("No tree id set");
}
final ObjectId treeId = this.treeId;
final ImmutableList<ObjectId> parentIds = ImmutableList.copyOf(this.parentIds);
final RevPerson author = RevPersonBuilder.build(this.author, authorEmail,
getAuthorTimestamp(), getAuthorTimeZoneOffset());
final RevPerson committer = RevPersonBuilder.build(this.committer, committerEmail,
getCommitterTimestamp(), getCommitterTimeZoneOffset());
final String commitMessage = this.message == null ? "" : this.message;
final ObjectId commitId = HashObject.hashCommit(treeId, parentIds, author, committer,
commitMessage);
return new RevCommitImpl(commitId, treeId, parentIds, author, committer, commitMessage);
}