Xin Li <delphij@xxxxxxxxxx> writes: > 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@xxxxxxxxxx> > --- > builtin/sparse-checkout.c | 2 ++ > t/t2404-worktree-config.sh | 4 +++- > 2 files changed, 5 insertions(+), 1 deletion(-) The other place that "extensions.*" is referred to is in builtin/init-db.c::initialize_repository_version() and it already makes sure that extensions.objectformat is set only in a repository whose verseion is GIT_REPO_VERSION_READ (which is 1---by the way I suspect we want a better name than _READ for the symbol---it wants to use the highest version supported by this binary), so with this patch we covered everything, hopefully. > diff --git a/builtin/sparse-checkout.c b/builtin/sparse-checkout.c > index 95d0882417..95669815d4 100644 > --- a/builtin/sparse-checkout.c > +++ b/builtin/sparse-checkout.c > @@ -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; > diff --git a/t/t2404-worktree-config.sh b/t/t2404-worktree-config.sh > index 286121d8de..9536d10919 100755 > --- a/t/t2404-worktree-config.sh > +++ b/t/t2404-worktree-config.sh > @@ -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' '