]> source.dussan.org Git - jgit.git/commitdiff
Add isIndexLoaded() to DfsPackFile. 67/8467/2
authorColby Ranger <cranger@google.com>
Thu, 1 Nov 2012 15:58:00 +0000 (08:58 -0700)
committerColby Ranger <cranger@google.com>
Thu, 1 Nov 2012 16:07:52 +0000 (09:07 -0700)
The method reports whether the index file for the pack has been loaded
and cached in memory.

Change-Id: Ifa8d63f737458e102cb3d28579c9711d46693d17

org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsPackFile.java

index daad02a14beabbabf41b6936b17e29981715e6b1..13f3c36981feb49ff8802a56ef1a5734e376c90c 100644 (file)
@@ -171,6 +171,12 @@ public final class DfsPackFile {
                return packDesc;
        }
 
+       /** @return whether the pack index file is loaded and cached in memory. */
+       public boolean isIndexLoaded() {
+               DfsBlockCache.Ref<PackIndex> idxref = index;
+               return idxref != null && idxref.get() != null;
+       }
+
        /** @return bytes cached in memory for this pack, excluding the index. */
        public long getCachedSize() {
                return key.cachedSize.get();