setup: rename "init.defaultRefFormat" to "init.defaultRefStorageFormat"

With the same reasoning as for git-init(1), rename the
"init.defaultRefFormat" config option to "init.defaultRefStorageFormat"
and keep the old name as an alias.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
next
Patrick Steinhardt 2026-09-09 13:12:58 +02:00 committed by Junio C Hamano
parent 3a58de10ad
commit 53d995c53f
5 changed files with 18 additions and 14 deletions

View File

@ -156,7 +156,7 @@ Cf. <2f5de416-04ba-c23d-1e0b-83bb655829a7@zombino.com>,
"packed-refs" file.
+
Users that get immediate benefit from the "reftable" backend could continue to
opt-in to the "reftable" format manually by setting the "init.defaultRefFormat"
opt-in to the "reftable" format manually by setting the "init.defaultRefStorageFormat"
config. But defaults matter, and we think that overall users will have a better
experience with less platform-specific quirks when they use the new backend by
default.

View File

@ -25,7 +25,7 @@ reusing objects from multiple packs instead of just one.
significantly smaller in the presence of certain filename collisions with Git's
default name-hash.
+
* `init.defaultRefFormat=reftable` causes newly initialized repositories to use
* `init.defaultRefStorageFormat=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

View File

@ -13,11 +13,13 @@ endif::[]
`--object-format=` in linkgit:git-init[1]. Both the command line option
and the `GIT_DEFAULT_HASH` environment variable take precedence over
this config.
`init.defaultRefFormat`::
`init.defaultRefStorageFormat`::
Allows overriding the default ref storage format for new repositories.
See `--ref-storage-format=` in linkgit:git-init[1]. Both the command line
option and the `GIT_DEFAULT_REF_STORAGE_FORMAT` environment variable take
precedence over this config.
`init.defaultRefFormat`::
Deprecated alias of `init.defaultRefStorageFormat`.

init.defaultSubmodulePathConfig::
A boolean that specifies if `git init` and `git clone` should

View File

@ -2697,7 +2697,8 @@ static int read_default_format_config(const char *key, const char *value,
goto out;
}

if (!strcmp(key, "init.defaultrefformat")) {
if (!strcmp(key, "init.defaultrefstorageformat") ||
!strcmp(key, "init.defaultrefformat")) {
ret = git_config_string(&str, key, value);
if (ret)
goto out;
@ -2709,7 +2710,7 @@ static int read_default_format_config(const char *key, const char *value,

/*
* Enable the reftable format when "features.experimental" is enabled.
* "init.defaultRefFormat" takes precedence over this setting.
* "init.defaultRefStorageFormat" takes precedence over this setting.
*/
if (!strcmp(key, "feature.experimental") &&
cfg->ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN &&
@ -2784,7 +2785,8 @@ static void repository_format_configure(struct repository_format *repo_fmt,
* 5. Its deprecated equivalent "GIT_DEFAULT_REF_FORMAT".
*
* 6. The default ref storage format for new repositories as
* configured via "init.defaultRefFormat"
* configured via "init.defaultRefStorageFormat" or its deprecated
* equivalent "init.defaultRefFormat".
*
* 7. Otherwise, we fall back to the default ref storage format
* compiled into Git.

View File

@ -659,9 +659,9 @@ test_expect_success 'GIT_REF_STORAGE_FORMAT refuses to reinitialize with differe
test_cmp expect err
'

test_expect_success 'init warns about invalid init.defaultRefFormat' '
test_expect_success 'init warns about invalid init.defaultRefStorageFormat' '
test_when_finished "rm -rf repo" &&
test_config_global init.defaultRefFormat garbage &&
test_config_global init.defaultRefStorageFormat garbage &&

echo "warning: unknown ref storage format ${SQ}garbage${SQ}" >expect &&
git init repo 2>err &&
@ -714,9 +714,9 @@ do
test_cmp expect actual
'

test_expect_success "init with init.defaultRefFormat=$format" '
test_expect_success "init with init.defaultRefStorageFormat=$format" '
test_when_finished "rm -rf refformat" &&
test_config_global init.defaultRefFormat $format &&
test_config_global init.defaultRefStorageFormat $format &&
(
sane_unset GIT_DEFAULT_REF_STORAGE_FORMAT &&
git init refformat
@ -753,9 +753,9 @@ test_expect_success "--ref-storage-format= overrides GIT_DEFAULT_REF_STORAGE_FOM
test_cmp expect actual
'

test_expect_success "GIT_DEFAULT_REF_STORAGE_FORMAT= overrides init.defaultRefFormat" '
test_expect_success "GIT_DEFAULT_REF_STORAGE_FORMAT= overrides init.defaultRefStorageFormat" '
test_when_finished "rm -rf refformat" &&
test_config_global init.defaultRefFormat files &&
test_config_global init.defaultRefStorageFormat files &&

GIT_DEFAULT_REF_STORAGE_FORMAT=reftable git init refformat &&
echo reftable >expect &&
@ -775,10 +775,10 @@ test_expect_success "init with feature.experimental=true" '
test_cmp expect actual
'

test_expect_success "init.defaultRefFormat overrides feature.experimental=true" '
test_expect_success "init.defaultRefStorageFormat overrides feature.experimental=true" '
test_when_finished "rm -rf refformat" &&
test_config_global feature.experimental true &&
test_config_global init.defaultRefFormat files &&
test_config_global init.defaultRefStorageFormat files &&
(
sane_unset GIT_DEFAULT_REF_STORAGE_FORMAT &&
git init refformat