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 https://github.com/git-for-windows/git/issues/3414 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Johannes Schindelin committed
Jan 9, 2026 at 20:05 UTC
7997e36561b9f7c084ea37ec280708736ab3dcb4
3 files changed
+5
-3
environment.c
+2
-2
@@ -324,8 +324,8 @@ next_name:
324
return (current & ~negative) | positive;
325
}
326
327
-static int git_default_core_config(const char *var, const char *value,
328
- const struct config_context *ctx, void *cb)
327
+int git_default_core_config(const char *var, const char *value,
328
+ const struct config_context *ctx, void *cb)
329
{
330
/* This needs a better name */
331
if (!strcmp(var, "core.filemode")) {
environment.h
+2
@@ -106,6 +106,8 @@ const char *strip_namespace(const char *namespaced_ref);
106
107
int git_default_config(const char *, const char *,
108
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);
111
112
/*
113
* TODO: All the below state either explicitly or implicitly relies on
setup.c
+1
-1
@@ -2693,7 +2693,7 @@ int init_db(const char *git_dir, const char *real_git_dir,
2693
* have set up the repository format such that we can evaluate
2694
* includeIf conditions correctly in the case of re-initialization.
2695
*/
2696
- repo_config(the_repository, platform_core_config, NULL);
2696
+ repo_config(the_repository, git_default_core_config, NULL);
2697
2698
safe_create_dir(the_repository, git_dir, 0);
2699