int commits = 0;
int minN = Integer.MAX_VALUE;
int maxN = 0;
AbbreviatedObjectId startId;
ObjectReader or = db.newObjectReader();
try {
final MutableObjectId id = new MutableObjectId();
RevWalk rw = new RevWalk(or);
TreeWalk tw = new TreeWalk(or);
tw.setFilter(TreeFilter.ANY_DIFF);
tw.setRecursive(true);
ObjectId start = db.resolve(Constants.HEAD);
startId = or.abbreviate(start);
rw.markStart(rw.parseCommit(start));
for (;;) {
final RevCommit c = rw.next();
if (c == null)
break;
commits++;
if (c.getParentCount() != 1)
continue;
RevCommit p = c.getParent(0);
rw.parseHeaders(p);
tw.reset(p.getTree(), c.getTree());
while (tw.next()) {
if (!isFile(tw, 0) || !isFile(tw, 1))
continue;
byte[] raw0;
try {
tw.getObjectId(id, 0);
raw0 = or.open(id).getCachedBytes(textLimit * 1024);
} catch (LargeObjectException tooBig) {
continue;
}
if (RawText.isBinary(raw0))
continue;
byte[] raw1;
try {
tw.getObjectId(id, 1);
raw1 = or.open(id).getCachedBytes(textLimit * 1024);
} catch (LargeObjectException tooBig) {
continue;
}
if (RawText.isBinary(raw1))
continue;
RawText txt0 = new RawText(raw0);
RawText txt1 = new RawText(raw1);
minN = Math.min(minN, txt0.size() + txt1.size());
maxN = Math.max(maxN, txt0.size() + txt1.size());
for (Test test : all)
testOne(test, txt0, txt1);
files++;
}
if (count > 0 && files > count)
break;
}
} finally {
or.release();
}
Collections.sort(all, new Comparator<Test>() {
public int compare(Test a, Test b) {
int cmp = Long.signum(a.runningTimeNanos - b.runningTimeNanos);