Skip to content

Commit 9011391

Browse files
dschoGit for Windows Build Agent
authored andcommitted
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 ac08008 commit 9011391

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

environment.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,8 @@ static enum fsync_component parse_fsync_components(const char *var, const char *
317317
return (current & ~negative) | positive;
318318
}
319319

320-
static int git_default_core_config(const char *var, const char *value,
321-
const struct config_context *ctx, void *cb)
320+
int git_default_core_config(const char *var, const char *value,
321+
const struct config_context *ctx, void *cb)
322322
{
323323
/* This needs a better name */
324324
if (!strcmp(var, "core.filemode")) {

environment.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ const char *strip_namespace(const char *namespaced_ref);
106106

107107
int git_default_config(const char *, const char *,
108108
const struct config_context *, void *);
109+
int git_default_core_config(const char *var, const char *value,
110+
const struct config_context *ctx, void *cb);
109111

110112
/*
111113
* TODO: All the below state either explicitly or implicitly relies on

setup.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2610,7 +2610,7 @@ int init_db(const char *git_dir, const char *real_git_dir,
26102610
* have set up the repository format such that we can evaluate
26112611
* includeIf conditions correctly in the case of re-initialization.
26122612
*/
2613-
repo_config(the_repository, platform_core_config, NULL);
2613+
repo_config(the_repository, git_default_core_config, NULL);
26142614

26152615
safe_create_dir(the_repository, git_dir, 0);
26162616

0 commit comments

Comments
 (0)