Skip to content

Commit 793b14e

Browse files
pks-tgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d0b9457 commit 793b14e

File tree

3 files changed

+52
-0
lines changed

3 files changed

+52
-0
lines changed

Documentation/config/feature.adoc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ reusing objects from multiple packs instead of just one.
2424
* `pack.usePathWalk` may speed up packfile creation and make the packfiles be
2525
significantly smaller in the presence of certain filename collisions with Git's
2626
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.
2733
2834
feature.manyFiles::
2935
Enable config options that optimize for repos with many files in the

setup.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2481,6 +2481,18 @@ static int read_default_format_config(const char *key, const char *value,
24812481
goto out;
24822482
}
24832483

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+
24842496
ret = 0;
24852497
out:
24862498
free(str);

t/t0001-init.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -749,6 +749,40 @@ test_expect_success "GIT_DEFAULT_REF_FORMAT= overrides init.defaultRefFormat" '
749749
test_cmp expect actual
750750
'
751751

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+
752786
for from_format in $backends
753787
do
754788
test_expect_success "re-init with same format ($from_format)" '

0 commit comments

Comments
 (0)