DiffFormatter formatter = new DiffFormatter(buffer);
formatter.setRepository(r);
formatter.setDiffComparator(cmp);
formatter.setDetectRenames(true);
RevTree commitTree = commit.getTree();
RevTree baseTree;
try {
if (baseCommit == null) {
if (commit.getParentCount() > 0) {
final RevWalk rw = new RevWalk(r);
RevCommit parent = rw.parseCommit(commit.getParent(0).getId());