Skip to content

Commit d5dcfe8

Browse files
committed
mingw: respect core.hidedotfiles = false in git-init again
This is a brown paper bag. When adding the tests, we actually failed to verify that the config variable is heeded in git-init at all. And when changing the original patch that marked the .git/ directory as hidden after reading the config, it was lost on this developer that the new code would use the hide_dotfiles variable before the config was read. The fix is obvious: read the (limited, pre-init) config *before* creating the .git/ directory. This fixes #789 Signed-off-by: Johannes Schindelin <[email protected]>
1 parent b76723d commit d5dcfe8

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

builtin/init-db.c

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

156+
if (starts_with(k, "core."))
157+
return platform_core_config(k, v);
158+
156159
return 0;
157160
}
158161

@@ -359,6 +362,9 @@ int init_db(const char *git_dir, const char *real_git_dir,
359362
}
360363
startup_info->have_repository = 1;
361364

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

364370
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
@@ -410,4 +410,16 @@ test_expect_success 're-init from a linked worktree' '
410410
)
411411
'
412412

413+
test_expect_success MINGW 'core.hidedotfiles = false' '
414+
git config --global core.hidedotfiles false &&
415+
rm -rf newdir &&
416+
(
417+
unset GIT_DIR GIT_WORK_TREE GIT_CONFIG
418+
mkdir newdir &&
419+
cd newdir &&
420+
git init
421+
) &&
422+
! is_hidden newdir/.git
423+
'
424+
413425
test_done

0 commit comments

Comments
 (0)