Thread (12 messages) flat view 12 messages, 4 authors, 20h ago

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(&params, old);
		git_config_append_parameter(&params, "maintenance.auto", "0");
		git_config_append_parameter(&params, "gc.auto", "0");
		opts->ctx->config_parameters = strbuf_detach(&params, NULL);
	}
	strbuf_pushf(..., opts->ctx->config_parameters);
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help