Fix processing of broken symbolic references in RefDirectory
Change-Id: I1f85890fe718f38ef4b62ebe711f0668267873a2
This commit is contained in:
parent
a3620cbbe1
commit
b297cf67a9
|
@ -290,17 +290,19 @@ public Map<String, Ref> getRefs(String prefix) throws IOException {
|
|||
|
||||
RefList.Builder<Ref> symbolic = scan.symbolic;
|
||||
for (int idx = 0; idx < symbolic.size();) {
|
||||
Ref ref = symbolic.get(idx);
|
||||
ref = resolve(ref, 0, prefix, loose, packed);
|
||||
if (ref != null && ref.getObjectId() != null) {
|
||||
symbolic.set(idx, ref);
|
||||
final Ref symbolicRef = symbolic.get(idx);
|
||||
final Ref resolvedRef = resolve(symbolicRef, 0, prefix, loose, packed);
|
||||
if (resolvedRef != null && resolvedRef.getObjectId() != null) {
|
||||
symbolic.set(idx, resolvedRef);
|
||||
idx++;
|
||||
} else {
|
||||
// A broken symbolic reference, we have to drop it from the
|
||||
// collections the client is about to receive. Should be a
|
||||
// rare occurrence so pay a copy penalty.
|
||||
loose = loose.remove(idx);
|
||||
symbolic.remove(idx);
|
||||
final int toRemove = loose.find(symbolicRef.getName());
|
||||
if (0 <= toRemove)
|
||||
loose = loose.remove(toRemove);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue