Re: [PATCH 2/5] init: do parse _all_ core.* settings early
From: Patrick Steinhardt <hidden>
Date: 2025-12-17 14:44:47
On Tue, Dec 16, 2025 at 03:33:46PM +0000, Johannes Schindelin via GitGitGadget wrote:
quoted hunk ↗ jump to hunk
diff --git a/setup.c b/setup.c index 7086741e6c..42e4e7a690 100644 --- a/setup.c +++ b/setup.c@@ -2611,7 +2611,7 @@ int init_db(const char *git_dir, const char *real_git_dir, * have set up the repository format such that we can evaluate * includeIf conditions correctly in the case of re-initialization. */ - repo_config(the_repository, platform_core_config, NULL); + repo_config(the_repository, git_default_core_config, NULL); safe_create_dir(the_repository, git_dir, 0);
Two lines further down we call `create_default_files()`, and there we end up calling `repo_config(the_repository, git_default_config, NULL)` as one of the first things. We do so after copying templates though, so indeed this comes too late. We also cannot really merge these two calls: we need to re-parse the configuration after having copied over the template, as the template may contain a gitconfig file itself. Furthermore, `git_default_core_config()` already knows to call `platform_core_config()`, as well. So we're not losing any of that information, either. All to say that this change makes sense to me and should be safe, as we don't end up parsing _more_ configuration keys, we only parse a subset of it a bit earlier. Patrick