From f6f8bcd9df74a56b8697c4272bee99168b46ab9d Mon Sep 17 00:00:00 2001 From: Colby Ranger Date: Thu, 1 Nov 2012 08:58:00 -0700 Subject: [PATCH] Add isIndexLoaded() to DfsPackFile. The method reports whether the index file for the pack has been loaded and cached in memory. Change-Id: Ifa8d63f737458e102cb3d28579c9711d46693d17 --- .../src/org/eclipse/jgit/storage/dfs/DfsPackFile.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsPackFile.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsPackFile.java index daad02a14..13f3c3698 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsPackFile.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsPackFile.java @@ -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 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();