summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/dfs/DfsBlockCacheTest.java13
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackFile.java4
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsStreamKey.java15
3 files changed, 8 insertions, 24 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/dfs/DfsBlockCacheTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/dfs/DfsBlockCacheTest.java
index ab588cb71e..3dd4190c83 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/dfs/DfsBlockCacheTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/dfs/DfsBlockCacheTest.java
@@ -289,8 +289,7 @@ public class DfsBlockCacheTest {
assertEquals(1, cache.getMissCount()[PackExt.BITMAP_INDEX.ordinal()]);
assertEquals(1, cache.getMissCount()[PackExt.INDEX.ordinal()]);
- // Reverse index has no pack extension, it defaults to 0.
- assertEquals(1, cache.getMissCount()[0]);
+ assertEquals(1, cache.getMissCount()[PackExt.REVERSE_INDEX.ordinal()]);
}
@SuppressWarnings("resource")
@@ -319,7 +318,7 @@ public class DfsBlockCacheTest {
waitForExecutorPoolTermination();
assertEquals(2, cache.getMissCount()[PackExt.BITMAP_INDEX.ordinal()]);
assertEquals(2, cache.getMissCount()[PackExt.INDEX.ordinal()]);
- assertEquals(2, cache.getMissCount()[0]);
+ assertEquals(2, cache.getMissCount()[PackExt.REVERSE_INDEX.ordinal()]);
}
@SuppressWarnings("resource")
@@ -348,7 +347,7 @@ public class DfsBlockCacheTest {
waitForExecutorPoolTermination();
assertEquals(2, cache.getMissCount()[PackExt.BITMAP_INDEX.ordinal()]);
assertEquals(2, cache.getMissCount()[PackExt.INDEX.ordinal()]);
- assertEquals(2, cache.getMissCount()[0]);
+ assertEquals(2, cache.getMissCount()[PackExt.REVERSE_INDEX.ordinal()]);
}
@SuppressWarnings("resource")
@@ -380,7 +379,7 @@ public class DfsBlockCacheTest {
assertEquals(2, cache.getMissCount()[PackExt.BITMAP_INDEX.ordinal()]);
// Index is loaded once for each repo.
assertEquals(2, cache.getMissCount()[PackExt.INDEX.ordinal()]);
- assertEquals(2, cache.getMissCount()[0]);
+ assertEquals(2, cache.getMissCount()[PackExt.REVERSE_INDEX.ordinal()]);
}
@Test
@@ -402,7 +401,7 @@ public class DfsBlockCacheTest {
assertEquals(1, cache.getMissCount()[PackExt.BITMAP_INDEX.ordinal()]);
assertEquals(1, cache.getMissCount()[PackExt.INDEX.ordinal()]);
- assertEquals(1, cache.getMissCount()[0]);
+ assertEquals(1, cache.getMissCount()[PackExt.REVERSE_INDEX.ordinal()]);
}
@Test
@@ -426,7 +425,7 @@ public class DfsBlockCacheTest {
assertEquals(1, cache.getMissCount()[PackExt.BITMAP_INDEX.ordinal()]);
assertEquals(1, cache.getMissCount()[PackExt.INDEX.ordinal()]);
- assertEquals(1, cache.getMissCount()[0]);
+ assertEquals(1, cache.getMissCount()[PackExt.REVERSE_INDEX.ordinal()]);
}
private void resetCache() {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackFile.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackFile.java
index f7a2c94d48..15511fed30 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackFile.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackFile.java
@@ -16,6 +16,7 @@ import static org.eclipse.jgit.internal.storage.dfs.DfsObjDatabase.PackSource.UN
import static org.eclipse.jgit.internal.storage.pack.PackExt.BITMAP_INDEX;
import static org.eclipse.jgit.internal.storage.pack.PackExt.INDEX;
import static org.eclipse.jgit.internal.storage.pack.PackExt.PACK;
+import static org.eclipse.jgit.internal.storage.pack.PackExt.REVERSE_INDEX;
import java.io.BufferedInputStream;
import java.io.EOFException;
@@ -220,8 +221,7 @@ public final class DfsPackFile extends BlockBasedFile {
}
PackIndex idx = idx(ctx);
- DfsStreamKey revKey = new DfsStreamKey.ForReverseIndex(
- desc.getStreamKey(INDEX));
+ DfsStreamKey revKey = desc.getStreamKey(REVERSE_INDEX);
AtomicBoolean cacheHit = new AtomicBoolean(true);
DfsBlockCache.Ref<PackReverseIndex> revref = cache.getOrLoadRef(revKey,
REF_POSITION, () -> {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsStreamKey.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsStreamKey.java
index 4a6723f830..f3f30914f6 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsStreamKey.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsStreamKey.java
@@ -95,19 +95,4 @@ public abstract class DfsStreamKey {
return false;
}
}
-
- static final class ForReverseIndex extends DfsStreamKey {
- private final DfsStreamKey idxKey;
-
- ForReverseIndex(DfsStreamKey idxKey) {
- super(idxKey.hash + 1, null);
- this.idxKey = idxKey;
- }
-
- @Override
- public boolean equals(Object o) {
- return o instanceof ForReverseIndex
- && idxKey.equals(((ForReverseIndex) o).idxKey);
- }
- }
}