aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorShawn Pearce <spearce@spearce.org>2011-02-15 09:33:31 -0500
committerCode Review <codereview-daemon@eclipse.org>2011-02-15 09:33:31 -0500
commit3a00ffa528bd749ef7b3156782ffb8d4e281cbda (patch)
tree3ccc202750ed41565f6083b9b019ca5c6842eeb3 /org.eclipse.jgit
parent8235b88a4bb453b6bf5dbfbb6f12f25d3c23793e (diff)
parentb297cf67a960b8cd1c03fc72357e2615ca7ba636 (diff)
downloadjgit-3a00ffa528bd749ef7b3156782ffb8d4e281cbda.tar.gz
jgit-3a00ffa528bd749ef7b3156782ffb8d4e281cbda.zip
Merge "Fix processing of broken symbolic references in RefDirectory"
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/storage/file/RefDirectory.java12
1 files changed, 7 insertions, 5 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/RefDirectory.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/RefDirectory.java
index c8c7d0dd83..e8ce2c5467 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/RefDirectory.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/RefDirectory.java
@@ -290,17 +290,19 @@ public class RefDirectory extends RefDatabase {
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);
}
}