From: Tian Yuchen Date: Tue, 14 Jul 2026 03:19:37 GMT Subject: Re: [PATCH v11 06/10] environment: migrate apply_default_whitespace and apply_default_ignorewhitespace Message-ID: <61ef1b0a-72e8-45b3-b6e8-46eb5b34ea91@malon.dev> In-Reply-To: On 7/14/26 00:39, Junio C Hamano wrote: > Tian Yuchen writes: > >> Subject: Re: [PATCH v11 06/10] environment: migrate apply_default_whitespace and apply_default_ignorewhitespace > > Are there patches 7..10/10 posted somewhere else? I didn't see them > in the thread (neither did "b4"). > Oh, I didn't notice that: Died at /usr/lib/git-core/git-send-email line 1665. Will resend very soon. >> >> -static void git_apply_config(void) >> +static void git_apply_config(struct repository *repo) >> { >> - repo_config_get_string(the_repository, "apply.whitespace", &apply_default_whitespace); >> - repo_config_get_string(the_repository, "apply.ignorewhitespace", &apply_default_ignorewhitespace); >> - repo_config(the_repository, git_xmerge_config, NULL); >> + struct repo_config_values *cfg = repo_config_values(repo); >> + >> + FREE_AND_NULL(cfg->apply_default_whitespace); >> + repo_config_get_string(repo, "apply.whitespace", >> + &cfg->apply_default_whitespace); >> + FREE_AND_NULL(cfg->apply_default_ignorewhitespace); >> + repo_config_get_string(repo, "apply.ignorewhitespace", >> + &cfg->apply_default_ignorewhitespace); >> + repo_config(repo, git_xmerge_config, NULL); >> } > > OK. > >> static int parse_whitespace_option(struct apply_state *state, const char *option) >> @@ -126,10 +132,15 @@ int init_apply_state(struct apply_state *state, >> strset_init(&state->kept_symlinks); >> strbuf_init(&state->root, 0); >> >> - git_apply_config(); >> - if (apply_default_whitespace && parse_whitespace_option(state, apply_default_whitespace)) >> + git_apply_config(repo); >> + >> + struct repo_config_values *cfg = repo_config_values(repo); > > Doesn't "-Wdeclaration-after-statement" complain on this, declaring cfg > after calling "git_apply_config(repo)" on the line before? > Nice catch, thanks! Regards, yuchen