diff options
author | Elijah Newren <newren@gmail.com> | 2023-05-16 08:33:41 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-06-21 20:14:33 +0200 |
commit | 0f7443bdc7284ad36e5d0cd8b2526e2123b8aa4f (patch) | |
tree | f7893747b3f1f2f38ca5345270ce60db60cece09 /t/t5606-clone-options.sh | |
parent | The second batch for 2.42 (diff) | |
download | git-0f7443bdc7284ad36e5d0cd8b2526e2123b8aa4f.tar.xz git-0f7443bdc7284ad36e5d0cd8b2526e2123b8aa4f.zip |
init-db: document existing bug with core.bare in template config
The comments in create_default_files() talks about reading config from
the config file in the specified `--templates` directory, which leads to
the question of whether core.bare could be set in such a config file and
thus whether the code is doing the right thing. It turns out, that it
doesn't; it unconditionally ignores core.bare in the config file in any
--templates directory. It is not clear to me that fixing it can be done
within this function; it seems to occur too late:
* create_default_files() is called by init_db()
* init_db() is called by both builtin/{clone.c,init-db.c}
* both callers of init_db() call set_git_work_tree() before init_db()
and in order to actual affect whether a repository is bear, we'd need to
somewhere reset these values, not just the is_bare_repository_cfg
setting.
I do not want to open this can of worms at this time; I'm trying to
clean up some headers, for which I need to move some functions, for
which I need to clean up some globals, and that's far enough down the
rabbit hole. So, simply document the issue with a careful TODO comment
and a few testcases.
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5606-clone-options.sh')
-rwxr-xr-x | t/t5606-clone-options.sh | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/t/t5606-clone-options.sh b/t/t5606-clone-options.sh index 27f9f77638..5890319b97 100755 --- a/t/t5606-clone-options.sh +++ b/t/t5606-clone-options.sh @@ -120,6 +120,16 @@ test_expect_success 'prefers -c config over --template config' ' ' +test_expect_failure 'prefers --template config even for core.bare' ' + + template="$TRASH_DIRECTORY/template-with-bare-config" && + mkdir "$template" && + git config --file "$template/config" core.bare true && + git clone "--template=$template" parent clone-bare-config && + test "$(git -C clone-bare-config config --local core.bare)" = "true" && + test_path_is_file clone-bare-config/HEAD +' + test_expect_success 'prefers config "clone.defaultRemoteName" over default' ' test_config_global clone.defaultRemoteName from_config && |