| `pack.deltaCompression` | `true` | ⃞ | Whether the writer will create new deltas on the fly. `true` if the pack writer will create a new delta when either `pack.reuseDeltas` is false, or no suitable delta is available for reuse. |
| `pack.depth` | `50` | ✅ | Maximum depth of delta chain set up for the pack writer. |
| `pack.indexVersion` | `2` | ✅ | Pack index file format version. |
+| `pack.minBytesForObjSizeIndex` | `-1` | ⃞ | Minimum size of an object (inclusive, in bytes) to be included in the size index. -1 to disable the object size index. |
| `pack.minSizePreventRacyPack` | `100 MiB` | ⃞ | Minimum packfile size for which we wait before opening a newly written pack to prevent its lastModified timestamp could be racy if `pack.waitPreventRacyPack` is `true`. |
| `pack.preserveOldPacks` | `false` | ⃞ | Whether to preserve old packs in a preserved directory. |
| `prunePreserved`, only via API of PackConfig | `false` | ⃞ | Whether to remove preserved pack files in a preserved directory. |
import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_WAIT_PREVENT_RACYPACK;
import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_WINDOW;
import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_WINDOW_MEMORY;
+import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_MIN_BYTES_OBJ_SIZE_INDEX;
import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_PACK_SECTION;
import java.time.Duration;
*/
public static final String[] DEFAULT_BITMAP_EXCLUDED_REFS_PREFIXES = new String[0];
+ /**
+ * Default minimum size for an object to be included in the size index:
+ * {@value}
+ *
+ * @see #setMinBytesForObjSizeIndex(int)
+ * @since 6.5
+ */
+ public static final int DEFAULT_MIN_BYTES_FOR_OBJ_SIZE_INDEX = -1;
+
/**
* Default max time to spend during the search for reuse phase. This
* optimization is disabled by default: {@value}
private boolean singlePack;
+ private int minBytesForObjSizeIndex = DEFAULT_MIN_BYTES_FOR_OBJ_SIZE_INDEX;
+
/**
* Create a default configuration.
*/
this.cutDeltaChains = cfg.cutDeltaChains;
this.singlePack = cfg.singlePack;
this.searchForReuseTimeout = cfg.searchForReuseTimeout;
+ this.minBytesForObjSizeIndex = cfg.minBytesForObjSizeIndex;
}
/**
searchForReuseTimeout = timeout;
}
+ /**
+ * Minimum size of an object (inclusive) to be added in the object size
+ * index.
+ *
+ * A negative value disables the writing of the object size index.
+ *
+ * @return minimum size an object must have to be included in the object
+ * index.
+ * @since 6.5
+ */
+ public int getMinBytesForObjSizeIndex() {
+ return minBytesForObjSizeIndex;
+ }
+
+ /**
+ * Set minimum size an object must have to be included in the object size
+ * index.
+ *
+ * A negative value disables the object index.
+ *
+ * @param minBytesForObjSizeIndex
+ * minimum size (inclusive) of an object to be included in the
+ * object size index. -1 disables the index.
+ * @since 6.5
+ */
+ public void setMinBytesForObjSizeIndex(int minBytesForObjSizeIndex) {
+ this.minBytesForObjSizeIndex = minBytesForObjSizeIndex;
+ }
+
+ /**
+ * Should writers add an object size index when writing a pack.
+ *
+ * @return true to write an object-size index with the pack
+ * @since 6.5
+ */
+ public boolean isWriteObjSizeIndex() {
+ return this.minBytesForObjSizeIndex >= 0;
+ }
+
/**
* Update properties by setting fields from the configuration.
*
setMinSizePreventRacyPack(rc.getLong(CONFIG_PACK_SECTION,
CONFIG_KEY_MIN_SIZE_PREVENT_RACYPACK,
getMinSizePreventRacyPack()));
+ setMinBytesForObjSizeIndex(rc.getInt(CONFIG_PACK_SECTION,
+ CONFIG_KEY_MIN_BYTES_OBJ_SIZE_INDEX,
+ DEFAULT_MIN_BYTES_FOR_OBJ_SIZE_INDEX));
}
/** {@inheritDoc} */
b.append(", searchForReuseTimeout") //$NON-NLS-1$
.append(getSearchForReuseTimeout());
b.append(", singlePack=").append(getSinglePack()); //$NON-NLS-1$
+ b.append(", minBytesForObjSizeIndex=") //$NON-NLS-1$
+ .append(getMinBytesForObjSizeIndex());
return b.toString();
}
}