Skip to content

Commit 48ce6a4

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 902cb5b commit 48ce6a4

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
@@ -322,8 +322,8 @@ static enum fsync_component parse_fsync_components(const char *var, const char *
322322
return (current & ~negative) | positive;
323323
}
324324

325-
static int git_default_core_config(const char *var, const char *value,
326-
const struct config_context *ctx, void *cb)
325+
int git_default_core_config(const char *var, const char *value,
326+
const struct config_context *ctx, void *cb)
327327
{
328328
/* This needs a better name */
329329
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
@@ -2611,7 +2611,7 @@ int init_db(const char *git_dir, const char *real_git_dir,
26112611
* have set up the repository format such that we can evaluate
26122612
* includeIf conditions correctly in the case of re-initialization.
26132613
*/
2614-
repo_config(the_repository, platform_core_config, NULL);
2614+
repo_config(the_repository, git_default_core_config, NULL);
26152615

26162616
safe_create_dir(the_repository, git_dir, 0);
26172617

0 commit comments

Comments
 (0)