Skip to content

Commit 17c4a8b

Browse files
committed
init: do parse _all_ core.* settings early
In Git for Windows, `has_symlinks` is set to 0 by default. Therefore, we need to parse the config setting `core.symlinks` to know if it has been set to `true`. In `git init`, we must do that before copying the templates because they might contain symbolic links. Even if the support for symbolic links on Windows has not made it to upstream Git yet, we really should make sure that all the `core.*` settings are parsed before proceeding, as they might very well change the behavior of `git init` in a way the user intended. This fixes #3414 Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 230e4ca commit 17c4a8b

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

config.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1392,8 +1392,8 @@ int git_config_color(char *dest, const char *var, const char *value)
13921392
return 0;
13931393
}
13941394

1395-
static int git_default_core_config(const char *var, const char *value,
1396-
const struct config_context *ctx, void *cb)
1395+
int git_default_core_config(const char *var, const char *value,
1396+
const struct config_context *ctx, void *cb)
13971397
{
13981398
/* This needs a better name */
13991399
if (!strcmp(var, "core.filemode")) {

config.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,8 @@ typedef int (*config_fn_t)(const char *, const char *,
167167

168168
int git_default_config(const char *, const char *,
169169
const struct config_context *, void *);
170+
int git_default_core_config(const char *var, const char *value,
171+
const struct config_context *ctx, void *cb);
170172

171173
/**
172174
* Read a specific file in git-config format.

setup.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2586,7 +2586,7 @@ int init_db(const char *git_dir, const char *real_git_dir,
25862586
* have set up the repository format such that we can evaluate
25872587
* includeIf conditions correctly in the case of re-initialization.
25882588
*/
2589-
git_config(platform_core_config, NULL);
2589+
git_config(git_default_core_config, NULL);
25902590

25912591
safe_create_dir(git_dir, 0);
25922592

0 commit comments

Comments
 (0)