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>
tags/v0.10.1
Shawn O. Pearce 13 years ago
parent
commit
d00420ae6e

+ 4
- 1
org.eclipse.jgit/src/org/eclipse/jgit/storage/file/ObjectDirectory.java View File

@@ -217,7 +217,10 @@ public class ObjectDirectory extends FileObjectDatabase {
* history of the repository.
*/
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));
}


Loading…
Cancel
Save