Re: [PATCH v2 3/3] sequencer: keep auto maintenance out of the commands a sequence spawns
From: Junio C Hamano <hidden>
Date: 2026-09-04 21:21:59
"Thomas Bachem via GitGitGadget" [off-list ref] writes:
+ /* + * The GIT_CONFIG_PARAMETERS value that keeps auto maintenance out + * of the commands we spawn, built on first use. + */ + struct strbuf config_parameters;
Does this have to be a "struct strbuf", not "const char *"? The latter makes it clear that it will never change its value once you built it in disable_auto_maintenance().
+static void disable_auto_maintenance(struct replay_opts *opts,
+ struct child_process *cmd)
+{
+ struct strbuf *params = &opts->ctx->config_parameters;
+
+ if (!params->len) {
+ const char *old = getenv(CONFIG_DATA_ENVIRONMENT);
+
+ if (old && *old)
+ strbuf_addstr(params, old);
+ git_config_append_parameter(params, "maintenance.auto", "false");
+ git_config_append_parameter(params, "gc.auto", "0");
+ }
+ strvec_pushf(&cmd->env, "%s=%s", CONFIG_DATA_ENVIRONMENT, params->buf);
+}
This would then become something like
if (!opts->ctx->config_parameters) {
const char *old = getenv(CONFIG_DATA_ENVIRONMENT);
struct strbuf params = STRBUF_INIT;
if (old && *old)
strbuf_addstr(¶ms, old);
git_config_append_parameter(¶ms, "maintenance.auto", "0");
git_config_append_parameter(¶ms, "gc.auto", "0");
opts->ctx->config_parameters = strbuf_detach(¶ms, NULL);
}
strbuf_pushf(..., opts->ctx->config_parameters);