mirror of
https://github.com/git/git
synced 2024-09-13 13:24:41 +00:00
Merge branch 'mt/init-template-userpath-fix'
Regression fix. * mt/init-template-userpath-fix: init: fix bug regarding ~/ expansion in init.templateDir
This commit is contained in:
commit
5d5b147345
|
@ -212,8 +212,9 @@ static int create_default_files(const char *template_path,
|
||||||
* values (since we've just potentially changed what's available on
|
* values (since we've just potentially changed what's available on
|
||||||
* disk).
|
* disk).
|
||||||
*/
|
*/
|
||||||
git_config_get_value("init.templatedir", &init_template_dir);
|
git_config_get_pathname("init.templatedir", &init_template_dir);
|
||||||
copy_templates(template_path, init_template_dir);
|
copy_templates(template_path, init_template_dir);
|
||||||
|
free((char *)init_template_dir);
|
||||||
git_config_clear();
|
git_config_clear();
|
||||||
reset_shared_repository();
|
reset_shared_repository();
|
||||||
git_config(git_default_config, NULL);
|
git_config(git_default_config, NULL);
|
||||||
|
|
|
@ -186,21 +186,33 @@ test_expect_success 'init with --template (blank)' '
|
||||||
test_path_is_missing template-blank/.git/info/exclude
|
test_path_is_missing template-blank/.git/info/exclude
|
||||||
'
|
'
|
||||||
|
|
||||||
|
init_no_templatedir_env () {
|
||||||
|
(
|
||||||
|
sane_unset GIT_TEMPLATE_DIR &&
|
||||||
|
NO_SET_GIT_TEMPLATE_DIR=t &&
|
||||||
|
export NO_SET_GIT_TEMPLATE_DIR &&
|
||||||
|
git init "$1"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
test_expect_success 'init with init.templatedir set' '
|
test_expect_success 'init with init.templatedir set' '
|
||||||
mkdir templatedir-source &&
|
mkdir templatedir-source &&
|
||||||
echo Content >templatedir-source/file &&
|
echo Content >templatedir-source/file &&
|
||||||
test_config_global init.templatedir "${HOME}/templatedir-source" &&
|
test_config_global init.templatedir "${HOME}/templatedir-source" &&
|
||||||
(
|
|
||||||
mkdir templatedir-set &&
|
init_no_templatedir_env templatedir-set &&
|
||||||
cd templatedir-set &&
|
|
||||||
sane_unset GIT_TEMPLATE_DIR &&
|
|
||||||
NO_SET_GIT_TEMPLATE_DIR=t &&
|
|
||||||
export NO_SET_GIT_TEMPLATE_DIR &&
|
|
||||||
git init
|
|
||||||
) &&
|
|
||||||
test_cmp templatedir-source/file templatedir-set/.git/file
|
test_cmp templatedir-source/file templatedir-set/.git/file
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'init with init.templatedir using ~ expansion' '
|
||||||
|
mkdir -p templatedir-source &&
|
||||||
|
echo Content >templatedir-source/file &&
|
||||||
|
test_config_global init.templatedir "~/templatedir-source" &&
|
||||||
|
|
||||||
|
init_no_templatedir_env templatedir-expansion &&
|
||||||
|
test_cmp templatedir-source/file templatedir-expansion/.git/file
|
||||||
|
'
|
||||||
|
|
||||||
test_expect_success 'init --bare/--shared overrides system/global config' '
|
test_expect_success 'init --bare/--shared overrides system/global config' '
|
||||||
test_config_global core.bare false &&
|
test_config_global core.bare false &&
|
||||||
test_config_global core.sharedRepository 0640 &&
|
test_config_global core.sharedRepository 0640 &&
|
||||||
|
|
Loading…
Reference in a new issue