Re: [PATCH v11 06/10] environment: migrate apply_default_whitespace and apply_default_ignorewhitespace
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jul 13, 2026, 16:39 UTC
- Message-ID
- <xmqqa4ruyhbh.fsf@gitster.g>
- In-Reply-To
- <20260713035738.1606138-7-cat@malon.dev>
Tian Yuchen <cat@malon.dev> 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").
Show 17 quoted lines
>
> -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.
Show 10 quoted lines
> 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?