@@ -678,8 +678,9 @@ int cmd_config(int argc, const char **argv, const char *prefix)
else if (worktrees[0] && worktrees[1])
die(_("--worktree cannot be used with multiple "
"working trees unless the config\n"
- "extension worktreeConfig is enabled. "
- "Please read \"CONFIGURATION FILE\"\n"
+ "extension worktreeConfig is enabled "
+ "and core.repositoryFormatVersion is at least\n"
+ "1. Please read \"CONFIGURATION FILE\""
"section in \"git help worktree\" for details"));
else
given_config_source.file = git_pathdup("config");
@@ -77,5 +77,17 @@ test_expect_success 'config.worktree no longer read without extension' '
test_cmp_config -C wt1 shared this.is &&
test_cmp_config -C wt2 shared this.is
'
+test_expect_success 'show advice when extensions.* are not enabled' '
+ test_config core.repositoryformatversion 1 &&
+ test_config extensions.worktreeConfig true &&
+ git config --worktree test.one true &&
+ test_cmp_config true test.one &&
+ test_config core.repositoryformatversion 0 &&
+ test_must_fail git config --worktree test.two true 2>err &&
+ test_i18ngrep "extension worktreeConfig is enabled" err &&
+ git config --unset core.repositoryformatversion &&
+ test_must_fail git config --worktree test.three true 2>err &&
+ test_i18ngrep "core.repositoryFormatVersion is at least" err
+'
test_done