]> git.ipfire.org Git - thirdparty/git.git/commitdiff
setup: use "reftable" format when experimental features are enabled
authorPatrick Steinhardt <ps@pks.im>
Fri, 4 Jul 2025 09:42:57 +0000 (11:42 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 7 Jul 2025 13:26:21 +0000 (06:26 -0700)
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>
Documentation/config/feature.adoc
setup.c
t/t0001-init.sh

index cb49ff2604a6329f6d230a2cd2d79faa1a7b2dc9..924f5ff4e3caaa57eb1947da9f1d359e273ef998 100644 (file)
@@ -24,6 +24,12 @@ reusing objects from multiple packs instead of just one.
 * `pack.usePathWalk` may speed up packfile creation and make the packfiles be
 significantly smaller in the presence of certain filename collisions with Git's
 default name-hash.
++
+* `init.defaultRefFormat=reftable` causes newly initialized repositories to use
+the reftable format for storing references. This new format solves issues with
+case-insensitive filesystems, compresses better and performs significantly
+better with many use cases. Refer to Documentation/technical/reftable.adoc for
+more information on this new storage format.
 
 feature.manyFiles::
        Enable config options that optimize for repos with many files in the
diff --git a/setup.c b/setup.c
index f0c06c655a929a8f59d241cf693bc3f95637b46c..97d7824d07a117dfb692111bca9057647246ab3e 100644 (file)
--- a/setup.c
+++ b/setup.c
@@ -2481,6 +2481,18 @@ static int read_default_format_config(const char *key, const char *value,
                goto out;
        }
 
+       /*
+        * Enable the reftable format when "features.experimental" is enabled.
+        * "init.defaultRefFormat" takes precedence over this setting.
+        */
+       if (!strcmp(key, "feature.experimental") &&
+           cfg->ref_format == REF_STORAGE_FORMAT_UNKNOWN &&
+           git_config_bool(key, value)) {
+               cfg->ref_format = REF_STORAGE_FORMAT_REFTABLE;
+               ret = 0;
+               goto out;
+       }
+
        ret = 0;
 out:
        free(str);
index 186664162fcb8551019d1eb1612ab3e8c5630d8e..f593c5368746fa276154fb731a7fc3f21982e1a9 100755 (executable)
@@ -749,6 +749,40 @@ test_expect_success "GIT_DEFAULT_REF_FORMAT= overrides init.defaultRefFormat" '
        test_cmp expect actual
 '
 
+test_expect_success "init with feature.experimental=true" '
+       test_when_finished "rm -rf refformat" &&
+       test_config_global feature.experimental true &&
+       (
+               sane_unset GIT_DEFAULT_REF_FORMAT &&
+               git init refformat
+       ) &&
+       echo reftable >expect &&
+       git -C refformat rev-parse --show-ref-format >actual &&
+       test_cmp expect actual
+'
+
+test_expect_success "init.defaultRefFormat overrides feature.experimental=true" '
+       test_when_finished "rm -rf refformat" &&
+       test_config_global feature.experimental true &&
+       test_config_global init.defaultRefFormat files &&
+       (
+               sane_unset GIT_DEFAULT_REF_FORMAT &&
+               git init refformat
+       ) &&
+       echo files >expect &&
+       git -C refformat rev-parse --show-ref-format >actual &&
+       test_cmp expect actual
+'
+
+test_expect_success "GIT_DEFAULT_REF_FORMAT= overrides feature.experimental=true" '
+       test_when_finished "rm -rf refformat" &&
+       test_config_global feature.experimental true &&
+       GIT_DEFAULT_REF_FORMAT=files git init refformat &&
+       echo files >expect &&
+       git -C refformat rev-parse --show-ref-format >actual &&
+       test_cmp expect actual
+'
+
 for from_format in $backends
 do
        test_expect_success "re-init with same format ($from_format)" '