]> source.dussan.org Git - jgit.git/commitdiff
Add getPacks to ObjectDirectory 40/40/6
authorShawn O. Pearce <spearce@spearce.org>
Wed, 7 Oct 2009 01:21:03 +0000 (18:21 -0700)
committerShawn O. Pearce <spearce@spearce.org>
Mon, 4 Jan 2010 16:03:36 +0000 (08:03 -0800)
This exposes the list of known packs, allowing callers to list them
into a context like the objects/info/packs file.

Change-Id: I0b889564bd176836ff5c77ba310c6d229409dcd5
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectDirectory.java

index f94d0d5fb438fe8691f0bfa587efef3eda770024..a6fdbfae5caeb90b4ff059ff755e019665902177 100644 (file)
@@ -147,6 +147,18 @@ public class ObjectDirectory extends ObjectDatabase {
                return new File(new File(objects, d), f);
        }
 
+       /**
+        * @return unmodifiable collection of all known pack files local to this
+        *         directory. Most recent packs are presented first. Packs most
+        *         likely to contain more recent objects appear before packs
+        *         containing objects referenced by commits further back in the
+        *         history of the repository.
+        */
+       public Collection<PackFile> getPacks() {
+               final PackFile[] packs = packList.get().packs;
+               return Collections.unmodifiableCollection(Arrays.asList(packs));
+       }
+
        /**
         * Add a single existing pack to the list of available pack files.
         *