Browse Source

Make ObjectDirectory getPacks() work the first time

If an object hasn't been accessed yet the pack list for a repository
may not have been scanned from disk.  If an application (e.g. the dumb
transport servlet support code) asks for the pack list for an
ObjectDirectory, we should load it immediately.

Change-Id: I93d7b1bca422d905948e8e83b2afa83c8894a68b
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
stable-0.10
Shawn O. Pearce 14 years ago committed by Matthias Sohn
parent
commit
d00420ae6e
  1. 5
      org.eclipse.jgit/src/org/eclipse/jgit/storage/file/ObjectDirectory.java

5
org.eclipse.jgit/src/org/eclipse/jgit/storage/file/ObjectDirectory.java

@ -217,7 +217,10 @@ public class ObjectDirectory extends FileObjectDatabase {
* history of the repository. * history of the repository.
*/ */
public Collection<PackFile> getPacks() { public Collection<PackFile> getPacks() {
final PackFile[] packs = packList.get().packs; PackList list = packList.get();
if (list == NO_PACKS)
list = scanPacks(list);
PackFile[] packs = list.packs;
return Collections.unmodifiableCollection(Arrays.asList(packs)); return Collections.unmodifiableCollection(Arrays.asList(packs));
} }

Loading…
Cancel
Save