setup: use "reftable" format when experimental features are enabled
With the preceding commit we have announced the switch to the "reftable" format in Git 3.0 for newly created repositories. The format is being battle tested by GitLab and a couple of other developers, and except for a small handful of issues exposed early after it has been merged it has been rock solid. Regardless of that though the test user base is still comparatively small, which increases the risk that we miss critical bugs. Address this by enabling the reftable format when experimental features are enabled. This should increase the test user base by some margin and thus give us more input before making the format the default. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Patrick Steinhardt committed
Jul 4, 2025 at 11:42 UTC
793b14e1c833dd4ea0d85cdef53cc5ab38f7915e
3 files changed
+52
Documentation/config/feature.adoc
+6
@@ -24,6 +24,12 @@ reusing objects from multiple packs instead of just one.
24
* `pack.usePathWalk` may speed up packfile creation and make the packfiles be
25
significantly smaller in the presence of certain filename collisions with Git's
26
default name-hash.
27
++
28
+* `init.defaultRefFormat=reftable` causes newly initialized repositories to use
29
+the reftable format for storing references. This new format solves issues with
30
+case-insensitive filesystems, compresses better and performs significantly
31
+better with many use cases. Refer to Documentation/technical/reftable.adoc for
32
+more information on this new storage format.
33
34
feature.manyFiles::
35
Enable config options that optimize for repos with many files in the
setup.c
+12
@@ -2481,6 +2481,18 @@ static int read_default_format_config(const char *key, const char *value,
2481
goto out;
2482
}
2483
2484
+ /*
2485
+ * Enable the reftable format when "features.experimental" is enabled.
2486
+ * "init.defaultRefFormat" takes precedence over this setting.
2487
+ */
2488
+ if (!strcmp(key, "feature.experimental") &&
2489
+ cfg->ref_format == REF_STORAGE_FORMAT_UNKNOWN &&
2490
+ git_config_bool(key, value)) {
2491
+ cfg->ref_format = REF_STORAGE_FORMAT_REFTABLE;
2492
+ ret = 0;
2493
+ goto out;
2494
+ }
2495
+
2496
ret = 0;
2497
out:
2498
free(str);
t/t0001-init.sh
+34
@@ -749,6 +749,40 @@ test_expect_success "GIT_DEFAULT_REF_FORMAT= overrides init.defaultRefFormat" '
749
test_cmp expect actual
750
'
751
752
+test_expect_success "init with feature.experimental=true" '
753
+ test_when_finished "rm -rf refformat" &&
754
+ test_config_global feature.experimental true &&
755
+ (
756
+ sane_unset GIT_DEFAULT_REF_FORMAT &&
757
+ git init refformat
758
+ ) &&
759
+ echo reftable >expect &&
760
+ git -C refformat rev-parse --show-ref-format >actual &&
761
+ test_cmp expect actual
762
+'
763
+
764
+test_expect_success "init.defaultRefFormat overrides feature.experimental=true" '
765
+ test_when_finished "rm -rf refformat" &&
766
+ test_config_global feature.experimental true &&
767
+ test_config_global init.defaultRefFormat files &&
768
+ (
769
+ sane_unset GIT_DEFAULT_REF_FORMAT &&
770
+ git init refformat
771
+ ) &&
772
+ echo files >expect &&
773
+ git -C refformat rev-parse --show-ref-format >actual &&
774
+ test_cmp expect actual
775
+'
776
+
777
+test_expect_success "GIT_DEFAULT_REF_FORMAT= overrides feature.experimental=true" '
778
+ test_when_finished "rm -rf refformat" &&
779
+ test_config_global feature.experimental true &&
780
+ GIT_DEFAULT_REF_FORMAT=files git init refformat &&
781
+ echo files >expect &&
782
+ git -C refformat rev-parse --show-ref-format >actual &&
783
+ test_cmp expect actual
784
+'
785
+
786
for from_format in $backends
787
do
788
test_expect_success "re-init with same format ($from_format)" '