1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-10-28 12:59:41 +01:00

sparse-checkout: upgrade repository to version 1 when enabling extension

The 'extensions' configuration variable gets special meaning in the new
repository version, so when enabling the extension we should upgrade the
repository to version 1.

Signed-off-by: Xin Li <delphij@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Xin Li 2020-06-05 02:10:03 -07:00 committed by Junio C Hamano
parent 01bbbbd9da
commit 98564d8059
2 changed files with 5 additions and 1 deletions

View file

@ -249,6 +249,8 @@ static int set_config(enum sparse_checkout_mode mode)
{
const char *config_path;
if (upgrade_repository_format(1) < 0)
die(_("unable to upgrade repository format to enable worktreeConfig"));
if (git_config_set_gently("extensions.worktreeConfig", "true")) {
error(_("failed to set extensions.worktreeConfig setting"));
return 1;

View file

@ -23,8 +23,10 @@ test_expect_success 'config --worktree without extension' '
'
test_expect_success 'enable worktreeConfig extension' '
git config core.repositoryformatversion 1 &&
git config extensions.worktreeConfig true &&
test_cmp_config true extensions.worktreeConfig
test_cmp_config true extensions.worktreeConfig &&
test_cmp_config 1 core.repositoryformatversion
'
test_expect_success 'config is shared as before' '