aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorSam Delmerico <delmerico@google.com>2024-03-18 17:14:24 -0700
committerSam Delmerico <delmerico@google.com>2024-03-18 17:14:24 -0700
commit3ffde6e0151db7ed0f49bbb388de41825282555b (patch)
treef990e16fefa2d2b4765c81e7755b5564c2fa4c10 /org.eclipse.jgit
parenta052d54916c8828207a9743801384da7002a13c4 (diff)
downloadjgit-3ffde6e0151db7ed0f49bbb388de41825282555b.tar.gz
jgit-3ffde6e0151db7ed0f49bbb388de41825282555b.zip
PackBitmapIndex: hide packChecksum behind getter
This allows more flexibility in overriding the PackBitmapIndex and also allows us to turn PackBitmapIndex into an interface in https://review.gerrithub.io/c/eclipse-jgit/jgit/+/1178201. Change-Id: I3be611fad67ff38b308c0052a04149f1497858ae
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/Pack.java2
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackBitmapIndex.java10
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackBitmapIndexV1.java7
3 files changed, 16 insertions, 3 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/Pack.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/Pack.java
index 212dbb20aa..f87329ccc2 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/Pack.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/Pack.java
@@ -1154,7 +1154,7 @@ public class Pack implements Iterable<PackIndex.MutableEntry> {
PackBitmapIndex idx = PackBitmapIndex.open(bitmapIdxFile, idx(),
getReverseIdx());
// At this point, idx() will have set packChecksum.
- if (Arrays.equals(packChecksum, idx.packChecksum)) {
+ if (Arrays.equals(packChecksum, idx.getPackChecksum())) {
bitmapIdx = optionally(idx);
return idx;
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackBitmapIndex.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackBitmapIndex.java
index def4f3dc11..affd2c0761 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackBitmapIndex.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackBitmapIndex.java
@@ -132,8 +132,14 @@ public abstract class PackBitmapIndex {
reverseIndexSupplier, loadParallelRevIndex);
}
- /** Footer checksum applied on the bottom of the pack file. */
- byte[] packChecksum;
+ /**
+ * Footer checksum applied on the bottom of the pack file.
+ *
+ * @return checksum as a byte array
+ */
+ byte[] getPackChecksum() {
+ return null;
+ }
/**
* Finds the position in the bitmap of the object.
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackBitmapIndexV1.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackBitmapIndexV1.java
index f2f24b39cb..19608c1ce5 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackBitmapIndexV1.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackBitmapIndexV1.java
@@ -46,6 +46,8 @@ class PackBitmapIndexV1 extends BasePackBitmapIndex {
private static final int MAX_XOR_OFFSET = 126;
+ private byte[] packChecksum;
+
private static final ExecutorService executor = Executors
.newCachedThreadPool(new ThreadFactory() {
private final ThreadFactory baseFactory = Executors
@@ -269,6 +271,11 @@ class PackBitmapIndexV1 extends BasePackBitmapIndex {
return getPackIndex().hashCode();
}
+ @Override
+ public byte[] getPackChecksum() {
+ return this.packChecksum;
+ }
+
PackIndex getPackIndex() {
return packIndex;
}