checkParameter(refSpec.size() < 3, "Commit list is too long :%s", refSpec);
GeoGIG geogig = cli.getGeogig();
checkParameter(file != null, "Patch file not specified");
DiffOp diff = geogig.command(DiffOp.class).setReportTrees(true);
String oldVersion = resolveOldVersion();
String newVersion = resolveNewVersion();
diff.setOldVersion(oldVersion).setNewVersion(newVersion).setCompareIndex(cached);
Iterator<DiffEntry> entries;
if (paths.isEmpty()) {
entries = diff.setProgressListener(cli.getProgressListener()).call();
} else {
entries = Iterators.emptyIterator();
for (String path : paths) {
Iterator<DiffEntry> moreEntries = diff.setFilter(path)
.setProgressListener(cli.getProgressListener()).call();
entries = Iterators.concat(entries, moreEntries);
}
}