Skip to content

Commit 129eeb5

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 cf51b1d + 2787e79 commit 129eeb5

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

builtin/init-db.c

Lines changed: 11 additions & 3 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

@@ -188,9 +196,6 @@ static int create_default_files(const char *template_path)
188196
safe_create_dir(git_path_buf(&buf, "refs/heads"), 1);
189197
safe_create_dir(git_path_buf(&buf, "refs/tags"), 1);
190198

191-
/* Just look for `init.templatedir` */
192-
git_config(git_init_db_config, NULL);
193-
194199
/* First copy the templates -- we might have the default
195200
* config file there, in which case we would want to read
196201
* from it after installing.
@@ -358,6 +363,9 @@ int init_db(const char *template_dir, unsigned int flags)
358363
if (git_link)
359364
separate_git_dir(git_dir);
360365

366+
/* Just look for `init.templatedir` and `core.hidedotfiles` */
367+
git_config(git_init_db_config, NULL);
368+
361369
safe_create_dir(git_dir, 0);
362370

363371
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,4 +384,16 @@ 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_done

0 commit comments

Comments
 (0)