diff options
author | Chris Aniszczyk <caniszczyk@gmail.com> | 2010-05-03 03:40:06 -0400 |
---|---|---|
committer | Code Review <codereview-daemon@eclipse.org> | 2010-05-03 03:40:06 -0400 |
commit | 28e42cb463413e446b32360eec3c513557a3c6e9 (patch) | |
tree | 287084f809fd0ba088dfbd06e63aa315ce080f55 | |
parent | 11096a89a55852d18f340ffa53af1e17be5550c3 (diff) | |
parent | 374c28057a33c580f40a7c78ad906ee9f4d0587e (diff) | |
download | jgit-28e42cb463413e446b32360eec3c513557a3c6e9.tar.gz jgit-28e42cb463413e446b32360eec3c513557a3c6e9.zip |
Merge "Don't insert the same pack twice into a pack list"
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectDirectory.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectDirectory.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectDirectory.java index 8f96ef5f06..024bd15b03 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectDirectory.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectDirectory.java @@ -292,7 +292,20 @@ public class ObjectDirectory extends ObjectDatabase { PackList o, n; do { o = packList.get(); + + // If the pack in question is already present in the list + // (picked up by a concurrent thread that did a scan?) we + // do not want to insert it a second time. + // final PackFile[] oldList = o.packs; + final String name = pf.getPackFile().getName(); + for (PackFile p : oldList) { + if (PackFile.SORT.compare(pf, p) < 0) + break; + if (name.equals(p.getPackFile().getName())) + return; + } + final PackFile[] newList = new PackFile[1 + oldList.length]; newList[0] = pf; System.arraycopy(oldList, 0, newList, 1, oldList.length); |