"If new rev spec is specified then old rev spec is mandatory");
Iterator<DiffEntry> iterator;
if (cached) {
// compare the tree-ish (default to HEAD) and the index
DiffIndex diffIndex = command(DiffIndex.class).addFilter(this.pathFilter)
.setReportTrees(reportTrees);
if (oldRefSpec != null) {
diffIndex.setOldVersion(oldRefSpec);
}
iterator = diffIndex.call();
} else if (newRefSpec == null) {
DiffWorkTree workTreeIndexDiff = command(DiffWorkTree.class).setFilter(pathFilter)
.setReportTrees(reportTrees);
if (oldRefSpec != null) {