aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn Pearce <spearce@spearce.org>2017-09-06 16:37:54 -0700
committerShawn Pearce <spearce@spearce.org>2017-09-06 16:37:54 -0700
commitd0d15c38485011d32db2be1acf440110d20d6a1f (patch)
treedb2d8159d7eae911154f211398e522904c9ac4f0
parentf0a40b19334cdeeaab7f08269446d9901e26b175 (diff)
downloadjgit-d0d15c38485011d32db2be1acf440110d20d6a1f.tar.gz
jgit-d0d15c38485011d32db2be1acf440110d20d6a1f.zip
DfsGarbageCollector: support disabling conversion to reftable
When a repository is initially created using only reftable but doesn't yet have a GC pack, the garbage collector shouldn't scan the ref database. Support disabling the reftable conversion path. Change-Id: Iaaf3a4375cd43760b7181c1bd10244de8b2c5d9e
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsGarbageCollector.java16
1 files changed, 15 insertions, 1 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsGarbageCollector.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsGarbageCollector.java
index 06e5422a5c..304a93128f 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsGarbageCollector.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsGarbageCollector.java
@@ -107,6 +107,7 @@ public class DfsGarbageCollector {
private PackConfig packConfig;
private ReftableConfig reftableConfig;
+ private boolean convertToReftable = true;
private long reftableInitialMinUpdateIndex = 1;
private long reftableInitialMaxUpdateIndex = 1;
@@ -172,6 +173,19 @@ public class DfsGarbageCollector {
}
/**
+ * @param convert
+ * if true, {@link #setReftableConfig(ReftableConfig)} has been
+ * set non-null, and a GC reftable doesn't yet exist, the garbage
+ * collector will make one by scanning the existing references,
+ * and writing a new reftable. Default is {@code true}.
+ * @return {@code this}
+ */
+ public DfsGarbageCollector setConvertToReftable(boolean convert) {
+ convertToReftable = convert;
+ return this;
+ }
+
+ /**
* Set minUpdateIndex for the initial reftable created during conversion.
*
* @param u
@@ -671,7 +685,7 @@ public class DfsGarbageCollector {
}
private void writeReftable(DfsPackDescription pack) throws IOException {
- if (!hasGcReftable()) {
+ if (convertToReftable && !hasGcReftable()) {
writeReftable(pack, refsBefore);
return;
}