Skip to content

Commit a6fa264

Browse files
committed
Merge branch 'unhidden-git'
It has been reported that core.hideDotFiles=false stopped working... This topic branch fixes it. Signed-off-by: Johannes Schindelin <[email protected]>
2 parents edf063f + 89fcdf3 commit a6fa264

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

builtin/init-db.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,14 @@ static int git_init_db_config(const char *k, const char *v, void *cb)
154154
if (!strcmp(k, "init.templatedir"))
155155
return git_config_pathname(&init_db_template_dir, k, v);
156156

157+
if (!strcmp(k, "core.hidedotfiles")) {
158+
if (v && !strcasecmp(v, "dotgitonly"))
159+
hide_dotfiles = HIDE_DOTFILES_DOTGITONLY;
160+
else
161+
hide_dotfiles = git_config_bool(k, v);
162+
return 0;
163+
}
164+
157165
return 0;
158166
}
159167

@@ -368,6 +376,9 @@ int init_db(const char *template_dir, unsigned int flags)
368376
if (git_link)
369377
separate_git_dir(git_dir);
370378

379+
/* Just look for `init.templatedir` and `core.hidedotfiles` */
380+
git_config(git_init_db_config, NULL);
381+
371382
safe_create_dir(git_dir, 0);
372383

373384
init_is_bare_repository = is_bare_repository();

t/t0001-init.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,18 @@ test_expect_success MINGW 'bare git dir not hidden' '
384384
! is_hidden newdir
385385
'
386386

387+
test_expect_success MINGW 'core.hidedotfiles = false' '
388+
git config --global core.hidedotfiles false &&
389+
rm -rf newdir &&
390+
(
391+
unset GIT_DIR GIT_WORK_TREE GIT_CONFIG
392+
mkdir newdir &&
393+
cd newdir &&
394+
git init
395+
) &&
396+
! is_hidden newdir/.git
397+
'
398+
387399
test_expect_success 'remote init from does not use config from cwd' '
388400
rm -rf newdir &&
389401
test_config core.logallrefupdates true &&

0 commit comments

Comments
 (0)