summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsInserter.java2
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsObjDatabase.java19
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackParser.java2
3 files changed, 20 insertions, 3 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsInserter.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsInserter.java
index dfab7bab6f..a07d8416c4 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsInserter.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsInserter.java
@@ -217,7 +217,7 @@ public class DfsInserter extends ObjectInserter {
db.commitPack(Collections.singletonList(packDsc), null);
rollback = false;
- DfsPackFile p = new DfsPackFile(cache, packDsc);
+ DfsPackFile p = db.createDfsPackFile(cache, packDsc);
if (index != null)
p.setPackIndex(index);
db.addPack(p);
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsObjDatabase.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsObjDatabase.java
index 2375698303..9f6eb10256 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsObjDatabase.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsObjDatabase.java
@@ -592,7 +592,7 @@ public abstract class DfsObjDatabase extends ObjectDatabase {
if (oldPack != null) {
newPacks.add(oldPack);
} else if (dsc.hasFileExt(PackExt.PACK)) {
- newPacks.add(new DfsPackFile(cache, dsc));
+ newPacks.add(createDfsPackFile(cache, dsc));
foundNew = true;
}
@@ -617,6 +617,23 @@ public abstract class DfsObjDatabase extends ObjectDatabase {
newReftables.toArray(new DfsReftable[0]));
}
+ /**
+ * Create instances of DfsPackFile
+ *
+ * Implementors can decide to construct or wrap DfsPackFile in different
+ * ways.
+ *
+ * @param cache
+ * block cache
+ * @param dsc
+ * pack description
+ * @return the dfs packfile
+ */
+ protected DfsPackFile createDfsPackFile(DfsBlockCache cache,
+ DfsPackDescription dsc) {
+ return new DfsPackFile(cache, dsc);
+ }
+
private static Map<DfsPackDescription, DfsPackFile> packMap(PackList old) {
Map<DfsPackDescription, DfsPackFile> forReuse = new HashMap<>();
for (DfsPackFile p : old.packs) {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackParser.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackParser.java
index a38ce91ccd..b19f65c69b 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackParser.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackParser.java
@@ -126,7 +126,7 @@ public class DfsPackParser extends PackParser {
objdb.commitPack(Collections.singletonList(packDsc), null);
rollback = false;
- DfsPackFile p = new DfsPackFile(blockCache, packDsc);
+ DfsPackFile p = objdb.createDfsPackFile(blockCache, packDsc);
p.setBlockSize(blockSize);
if (packIndex != null)
p.setPackIndex(packIndex);