@Override
public Map<ObjectId, String> call() throws GitAPIException {
try {
Map<ObjectId, String> nonCommits = new HashMap<ObjectId, String>();
FIFORevQueue pending = new FIFORevQueue();
if (refs != null) {
for (Ref ref : refs)
addRef(ref, nonCommits, pending);
}
addPrefixes(nonCommits, pending);
int cutoff = minCommitTime() - COMMIT_TIME_SLOP;
while (true) {
NameRevCommit c = (NameRevCommit) pending.next();
if (c == null)
break;
if (c.getCommitTime() < cutoff)
continue;
for (int i = 0; i < c.getParentCount(); i++) {
NameRevCommit p = (NameRevCommit) walk.parseCommit(c.getParent(i));
long cost = c.cost + (i > 0 ? mergeCost : 1);
if (p.tip == null || compare(c.tip, cost, p.tip, p.cost) < 0) {
if (i > 0) {
p.tip = c.format().append('^').append(i + 1).toString();
p.distance = 0;
} else {
p.tip = c.tip;
p.distance = c.distance + 1;
}
p.cost = cost;
pending.add(p);
}
}
}
Map<ObjectId, String> result =