DiffWorkTree workTreeIndexDiff = command(DiffWorkTree.class).setFilter(pathFilter)
.setReportTrees(reportTrees);
if (oldRefSpec != null) {
workTreeIndexDiff.setOldVersion(oldRefSpec);
}
iterator = workTreeIndexDiff.call();
} else {
iterator = command(DiffTree.class).setOldVersion(oldRefSpec).setNewVersion(newRefSpec)
.setPathFilter(pathFilter).setReportTrees(reportTrees).call();
}