summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorMarc Strapetz2011-02-09 06:54:09 (EST)
committer Marc Strapetz2011-02-15 03:33:39 (EST)
commitb297cf67a960b8cd1c03fc72357e2615ca7ba636 (patch)
treed88c27d65bf7f7a914cba178eaa2a9da9d3eeb4d
parenta3620cbbe144c9b666ce4472fd5e8ef1222bd641 (diff)
downloadjgit-b297cf67a960b8cd1c03fc72357e2615ca7ba636.zip
jgit-b297cf67a960b8cd1c03fc72357e2615ca7ba636.tar.gz
jgit-b297cf67a960b8cd1c03fc72357e2615ca7ba636.tar.bz2
Fix processing of broken symbolic references in RefDirectoryrefs/changes/62/2462/2
-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 c8c7d0d..e8ce2c5 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);
}
}