]> source.dussan.org Git - jgit.git/commitdiff
DfsPackFile: make #getReverseIdx public 52/202752/1
authorAnna Papitto <annapapitto@google.com>
Tue, 27 Jun 2023 20:22:20 +0000 (13:22 -0700)
committerAnna Papitto <annapapitto@google.com>
Tue, 27 Jun 2023 20:25:29 +0000 (13:25 -0700)
The DfsPackFile#getReverseIdx method, which wraps creating a
PackReverseIndex in caching, was package-private. This caused
implementations on top of DfsPackFile to directly instantiate a
PackReverseIndex in cases where it would benefit from caching.

Instead, make #getReverseIdx public so that the caching logic can be
reused by implementations where appropriate.

Change-Id: I4553e514a4ac320bfe2455c00023343ad97f9d15
Signed-off-by: Anna Papitto <annapapitto@google.com>
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackFile.java

index 7e1f0ad87ca4bd8d97ec4d2ffb95ba11016f51d7..f61f8c61a969ceac42ce2ac7a376c41841c865cb 100644 (file)
@@ -259,7 +259,17 @@ public final class DfsPackFile extends BlockBasedFile {
                return commitGraph;
        }
 
-       PackReverseIndex getReverseIdx(DfsReader ctx) throws IOException {
+       /**
+        * Get the PackReverseIndex for this PackFile.
+        *
+        * @param ctx
+        *            reader context to support reading from the backing store if
+        *            the index is not already loaded in memory
+        * @return the PackReverseIndex
+        * @throws java.io.IOException
+        *             the pack index is not available, or is corrupt
+        */
+       public PackReverseIndex getReverseIdx(DfsReader ctx) throws IOException {
                if (reverseIndex != null) {
                        return reverseIndex;
                }