]> source.dussan.org Git - jgit.git/commitdiff
Remove getReverseIndexSize() from DfsPackDescription. 90/9690/2
authorColby Ranger <cranger@google.com>
Tue, 15 Jan 2013 22:56:48 +0000 (14:56 -0800)
committerColby Ranger <cranger@google.com>
Tue, 15 Jan 2013 23:12:55 +0000 (15:12 -0800)
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

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

index 62fce3b73a4bb53b2c6ba9970301f7ff512b1e80..9cb29af5d29ecf3ecb98f3cb32f0acb01a5a9da6 100644 (file)
@@ -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;
index 8a4bd2e53456719898ac9c047d41adca91271470..4c41557e5dc73b7fc0cd28940ecc5d97e7174b59 100644 (file)
@@ -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;
                }
        }