*/
public List<DiffEntry> scan(AbstractTreeIterator a, AbstractTreeIterator b)
throws IOException {
assertHaveRepository();
TreeWalk walk = new TreeWalk(reader);
walk.addTree(a);
walk.addTree(b);
walk.setRecursive(true);
TreeFilter filter = getDiffTreeFilterFor(a, b);
if (pathFilter instanceof FollowFilter) {
walk.setFilter(AndTreeFilter.create(
PathFilter.create(((FollowFilter) pathFilter).getPath()),
filter));
} else {
walk.setFilter(AndTreeFilter.create(pathFilter, filter));
}
source = new ContentSource.Pair(source(a), source(b));
List<DiffEntry> files = DiffEntry.scan(walk);
if (pathFilter instanceof FollowFilter && isAdd(files)) {
// The file we are following was added here, find where it
// came from so we can properly show the rename or copy,
// then continue digging backwards.
//
a.reset();
b.reset();
walk.reset();
walk.addTree(a);
walk.addTree(b);
walk.setFilter(filter);
if (renameDetector == null)
setDetectRenames(true);
files = updateFollowFilter(detectRenames(DiffEntry.scan(walk)));