diff options
author | Colby Ranger <cranger@google.com> | 2013-01-15 14:56:48 -0800 |
---|---|---|
committer | Colby Ranger <cranger@google.com> | 2013-01-15 15:12:55 -0800 |
commit | 3f0176aea6e77cb39be35f091100f8874693593d (patch) | |
tree | 631a4af62c1ed9d451bff1d1ba4446e4fcbe2489 | |
parent | 510a60554696586301f1300f3fbef66cc0be1a8f (diff) | |
download | jgit-3f0176aea6e77cb39be35f091100f8874693593d.tar.gz jgit-3f0176aea6e77cb39be35f091100f8874693593d.zip |
Remove getReverseIndexSize() from DfsPackDescription.
The method is used in only one location (DfsPackFile). Furthermore,
PackIndex already does an explicit computation of the size in
DfsPackFile. Simplify the DfsPackDescription by removing the method
and do the calculation similar to PackIndex.
Change-Id: I1391fdaaf7c2c3226d96ada1ae8647bcdff4794e
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsPackDescription.java | 7 | ||||
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsPackFile.java | 8 |
2 files changed, 5 insertions, 10 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 62fce3b73a..9cb29af5d2 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 @@ -168,13 +168,6 @@ public class DfsPackDescription implements Comparable<DfsPackDescription> { return size == null ? 0 : size.longValue(); } - /** - * @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 8a4bd2e534..4c41557e5d 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 @@ -283,9 +283,11 @@ public final class DfsPackFile { return revidx; } - PackReverseIndex revidx = new PackReverseIndex(idx(ctx)); - reverseIndex = cache.put(key, POS_REVERSE_INDEX, - packDesc.getReverseIndexSize(), revidx); + PackIndex idx = idx(ctx); + PackReverseIndex revidx = new PackReverseIndex(idx); + int sz = (int) Math.min( + idx.getObjectCount() * 8, Integer.MAX_VALUE); + reverseIndex = cache.put(key, POS_REVERSE_INDEX, sz, revidx); return revidx; } } |