|
|
@ -131,7 +131,7 @@ public class MergedReftable extends Reftable { |
|
|
|
/** {@inheritDoc} */ |
|
|
|
/** {@inheritDoc} */ |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public RefCursor byObjectId(AnyObjectId name) throws IOException { |
|
|
|
public RefCursor byObjectId(AnyObjectId name) throws IOException { |
|
|
|
MergedRefCursor m = new MergedRefCursor(); |
|
|
|
MergedRefCursor m = new FilteringMergedRefCursor(name); |
|
|
|
for (int i = 0; i < tables.length; i++) { |
|
|
|
for (int i = 0; i < tables.length; i++) { |
|
|
|
m.add(new RefQueueEntry(tables[i].byObjectId(name), i)); |
|
|
|
m.add(new RefQueueEntry(tables[i].byObjectId(name), i)); |
|
|
|
} |
|
|
|
} |
|
|
@ -250,6 +250,42 @@ public class MergedReftable extends Reftable { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private class FilteringMergedRefCursor extends MergedRefCursor { |
|
|
|
|
|
|
|
final AnyObjectId filterId; |
|
|
|
|
|
|
|
Ref filteredRef; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FilteringMergedRefCursor(AnyObjectId id) { |
|
|
|
|
|
|
|
filterId = id; |
|
|
|
|
|
|
|
filteredRef = null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public Ref getRef() { |
|
|
|
|
|
|
|
return filteredRef; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public boolean next() throws IOException { |
|
|
|
|
|
|
|
for (;;) { |
|
|
|
|
|
|
|
boolean ok = super.next(); |
|
|
|
|
|
|
|
if (!ok) { |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String name = super.getRef().getName(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try (RefCursor c = seekRef(name)) { |
|
|
|
|
|
|
|
if (c.next()) { |
|
|
|
|
|
|
|
if (filterId.equals(c.getRef().getObjectId())) { |
|
|
|
|
|
|
|
filteredRef = c.getRef(); |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static class RefQueueEntry { |
|
|
|
private static class RefQueueEntry { |
|
|
|
static int compare(RefQueueEntry a, RefQueueEntry b) { |
|
|
|
static int compare(RefQueueEntry a, RefQueueEntry b) { |
|
|
|
int cmp = a.name().compareTo(b.name()); |
|
|
|
int cmp = a.name().compareTo(b.name()); |
|
|
|