+
The default value is to create restart points every 16 records. A value of `0`
will use the default value.
+
+reftable.indexObjects::
+ Whether the reftable backend shall write object blocks. Object blocks
+ are a reverse mapping of object ID to the references pointing to them.
++
+The default value is `true`.
if (restart_interval > UINT16_MAX)
die("reftable block size cannot exceed %u", (unsigned)UINT16_MAX);
opts->restart_interval = restart_interval;
+ } else if (!strcmp(var, "reftable.indexobjects")) {
+ opts->skip_index_objects = !git_config_bool(var, value);
}
return 0;
)
'
+test_expect_success 'object index gets written by default with ref index' '
+ test_config_global core.logAllRefUpdates false &&
+ test_when_finished "rm -rf repo" &&
+ git init repo &&
+ (
+ cd repo &&
+ test_commit initial &&
+ for i in $(test_seq 5)
+ do
+ printf "update refs/heads/branch-%d HEAD\n" "$i" ||
+ return 1
+ done >input &&
+ git update-ref --stdin <input &&
+ git -c reftable.blockSize=100 pack-refs &&
+
+ cat >expect <<-EOF &&
+ header:
+ block_size: 100
+ ref:
+ - length: 53
+ restarts: 1
+ - length: 95
+ restarts: 1
+ - length: 71
+ restarts: 1
+ - length: 80
+ restarts: 1
+ obj:
+ - length: 11
+ restarts: 1
+ EOF
+ test-tool dump-reftable -b .git/reftable/*.ref >actual &&
+ test_cmp expect actual
+ )
+'
+
+test_expect_success 'object index can be disabled' '
+ test_config_global core.logAllRefUpdates false &&
+ test_when_finished "rm -rf repo" &&
+ git init repo &&
+ (
+ cd repo &&
+ test_commit initial &&
+ for i in $(test_seq 5)
+ do
+ printf "update refs/heads/branch-%d HEAD\n" "$i" ||
+ return 1
+ done >input &&
+ git update-ref --stdin <input &&
+ git -c reftable.blockSize=100 -c reftable.indexObjects=false pack-refs &&
+
+ cat >expect <<-EOF &&
+ header:
+ block_size: 100
+ ref:
+ - length: 53
+ restarts: 1
+ - length: 95
+ restarts: 1
+ - length: 71
+ restarts: 1
+ - length: 80
+ restarts: 1
+ EOF
+ test-tool dump-reftable -b .git/reftable/*.ref >actual &&
+ test_cmp expect actual
+ )
+'
+
test_done