summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorDave Borowitz2011-11-03 15:57:58 (EDT)
committer Shawn O. Pearce2011-11-04 14:14:32 (EDT)
commitd55eb351061de32f208a924ce076bb8903e9c379 (patch)
tree6c8d450d988935c35a9779fc707471b88290657b
parent4fc1af68501c70407ade42dc13906061939a499c (diff)
downloadjgit-d55eb351061de32f208a924ce076bb8903e9c379.zip
jgit-d55eb351061de32f208a924ce076bb8903e9c379.tar.gz
jgit-d55eb351061de32f208a924ce076bb8903e9c379.tar.bz2
Expose the reverse index size in the DfsPackDescriptionrefs/changes/44/4544/3
This is analogous to the getPackSize() and getIndexSize() methods. Change-Id: I207c0c93f9145826d84b3610eb4319fca074ee0d
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsPackDescription.java7
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsPackFile.java8
2 files changed, 10 insertions, 5 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsPackDescription.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsPackDescription.java
index 9e1e597..1bd5a78 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsPackDescription.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsPackDescription.java
@@ -164,6 +164,13 @@ public class DfsPackDescription implements Comparable<DfsPackDescription> {
return this;
}
+ /**
+ * @return size of the reverse index, in bytes.
+ */
+ public int getReverseIndexSize() {
+ return (int) Math.min(objectCount * 8, Integer.MAX_VALUE);
+ }
+
/** @return number of objects in the pack. */
public long getObjectCount() {
return objectCount;
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 573e8e7..7afcea2 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
@@ -265,11 +265,9 @@ public final class DfsPackFile {
return revidx;
}
- PackIndex fwdidx = idx(ctx);
- PackReverseIndex revidx = new PackReverseIndex(fwdidx);
- long objCnt = fwdidx.getObjectCount();
- int sz = (int) Math.min(objCnt * 8, Integer.MAX_VALUE);
- reverseIndex = cache.put(key, POS_REVERSE_INDEX, sz, revidx);
+ PackReverseIndex revidx = new PackReverseIndex(idx(ctx));
+ reverseIndex = cache.put(key, POS_REVERSE_INDEX,
+ packDesc.getReverseIndexSize(), revidx);
return revidx;
}
}