From: Patrick Steinhardt <ps@pks.im>
To: git@vger.kernel.org
Cc: "brian m. carlson" <sandals@crustytoothpaste.net>,
Karthik Nayak <karthik.188@gmail.com>,
K Jayatheerth <jayatheerthkulkarni2005@gmail.com>,
ryenus@gmail.com, Junio C Hamano <gitster@pobox.com>
Subject: [PATCH 2/2] setup: use "reftable" format when experimental features are enabled
Date: Wed, 02 Jul 2025 12:14:22 +0200 [thread overview]
Message-ID: <20250702-pks-reftable-default-backend-v1-2-84dbaddafb50@pks.im> (raw)
In-Reply-To: <20250702-pks-reftable-default-backend-v1-0-84dbaddafb50@pks.im>
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>
---
Documentation/config/feature.adoc | 6 ++++++
setup.c | 12 ++++++++++++
t/t0001-init.sh | 34 ++++++++++++++++++++++++++++++++++
3 files changed, 52 insertions(+)
diff --git a/Documentation/config/feature.adoc b/Documentation/config/feature.adoc
index cb49ff2604a..924f5ff4e3c 100644
--- a/Documentation/config/feature.adoc
+++ b/Documentation/config/feature.adoc
@@ -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 3ab0f11fbfd..8e9c0ffa1fe 100644
--- 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);
diff --git a/t/t0001-init.sh b/t/t0001-init.sh
index e0f27484192..df14d88ebb4 100755
--- a/t/t0001-init.sh
+++ b/t/t0001-init.sh
@@ -754,6 +754,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)" '
--
2.50.0.195.g74e6fc65d0.dirty
next prev parent reply other threads:[~2025-07-02 10:14 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-02 10:14 [PATCH 0/2] Add reftable by default as a breaking change Patrick Steinhardt
2025-07-02 10:14 ` [PATCH 1/2] BreakingChanges: announce switch to "reftable" format Patrick Steinhardt
2025-07-02 17:03 ` Junio C Hamano
2025-07-02 21:21 ` brian m. carlson
2025-07-03 4:43 ` Patrick Steinhardt
2025-07-03 4:43 ` Patrick Steinhardt
2025-07-02 17:17 ` Justin Tobler
2025-07-03 5:00 ` Patrick Steinhardt
2025-07-02 10:14 ` Patrick Steinhardt [this message]
2025-07-03 6:15 ` [PATCH v2 0/2] Add reftable by default as a breaking change Patrick Steinhardt
2025-07-03 6:15 ` [PATCH v2 1/2] BreakingChanges: announce switch to "reftable" format Patrick Steinhardt
2025-07-03 10:54 ` Karthik Nayak
2025-07-03 11:42 ` Patrick Steinhardt
2025-07-03 12:24 ` Karthik Nayak
2025-07-03 13:08 ` Patrick Steinhardt
2025-07-03 6:15 ` [PATCH v2 2/2] setup: use "reftable" format when experimental features are enabled Patrick Steinhardt
2025-07-07 5:37 ` [PATCH v2 0/2] Add reftable by default as a breaking change Junio C Hamano
2025-07-04 9:42 ` [PATCH v3 " Patrick Steinhardt
2025-07-04 9:42 ` [PATCH v3 1/2] BreakingChanges: announce switch to "reftable" format Patrick Steinhardt
2025-07-04 9:42 ` [PATCH v3 2/2] setup: use "reftable" format when experimental features are enabled Patrick Steinhardt
2025-07-04 13:14 ` [PATCH v3 0/2] Add reftable by default as a breaking change Karthik Nayak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250702-pks-reftable-default-backend-v1-2-84dbaddafb50@pks.im \
--to=ps@pks.im \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jayatheerthkulkarni2005@gmail.com \
--cc=karthik.188@gmail.com \
--cc=ryenus@gmail.com \
--cc=sandals@crustytoothpaste.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).