aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Strapetz2011-02-09 06:54:09 (EST)
committerMatthias Sohn2011-02-20 18:48:48 (EST)
commit57d13c047ffbe9d17d1eec966ae8f67f15184605 (patch)
tree0e467f943df76f9a4f380f7bce111ccf79192e74
parentc893b1f75f776c18f1fd1cdbbcc51856bcfe3bb5 (diff)
downloadjgit-57d13c047ffbe9d17d1eec966ae8f67f15184605.zip
jgit-57d13c047ffbe9d17d1eec966ae8f67f15184605.tar.gz
jgit-57d13c047ffbe9d17d1eec966ae8f67f15184605.tar.bz2
Fix processing of broken symbolic references in RefDirectoryrefs/changes/44/2544/1
Change-Id: Ic1ceb9c99dca2c69e61ea0ef03ec64f13714b80a Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
-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);
}
}