summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2009-10-06 18:21:03 -0700
committerShawn O. Pearce <spearce@spearce.org>2010-01-04 08:03:36 -0800
commit0b821817fcc8c0471c7a9685e9fd566e81a1bbbd (patch)
tree3ec91aed9e4be17d8c7eb6681e499dece49d3197
parente2c7bc8b36fb6faa9d5eaf0654b4c0ae32d96b85 (diff)
downloadjgit-0b821817fcc8c0471c7a9685e9fd566e81a1bbbd.tar.gz
jgit-0b821817fcc8c0471c7a9685e9fd566e81a1bbbd.zip
Add getPacks to ObjectDirectory
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>
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectDirectory.java12
1 files changed, 12 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 f94d0d5fb4..a6fdbfae5c 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectDirectory.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectDirectory.java
@@ -148,6 +148,18 @@ public class ObjectDirectory extends ObjectDatabase {
}
/**
+ * @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.
*
* @param pack