git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/4] run-command: use repo_start_command() in strict callers

From
Burak Kaan Karaçay <bkkaracay@gmail.com>
Date
Mar 11, 2026, 15:19 UTC
Message-ID
<20260311151923.4178655-3-bkkaracay@gmail.com>
In-Reply-To
<20260311151923.4178655-1-bkkaracay@gmail.com>

Some callers have been freed from global state and they do not define the 'USE_THE_REPOSITORY_VARIABLE' macro.

To complete the mitigation of 'start_command()', update these callers to use repo_start_command() and pass their local 'struct repository' as an argument, completely eliminating their hidden reliance on the global state.

Signed-off-by: Burak Kaan Karaçay <bkkaracay@gmail.com>
---
 builtin/difftool.c | 4 ++--
 odb.c              | 2 +-
 pager.c            | 2 +-
 repack-promisor.c  | 2 +-
 send-pack.c        | 4 ++--
 5 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/builtin/difftool.c b/builtin/difftool.c
index e4bc1f8316..15ac552edf 100644
--- a/builtin/difftool.c
+++ b/builtin/difftool.c
@@ -257,7 +257,7 @@ static void changed_files(struct repository *repo,
 	diff_files.out = -1;
 	diff_files.dir = workdir;
 	strvec_pushf(&diff_files.env, "GIT_INDEX_FILE=%s", index_path);
-	if (start_command(&diff_files))
+	if (repo_start_command(repo, &diff_files))
 		die("could not obtain raw diff");
 	fp = xfdopen(diff_files.out, "r");
 	while (!strbuf_getline_nul(&buf, fp)) {
@@ -437,7 +437,7 @@ static int run_dir_diff(struct repository *repo,
 	child->clean_on_exit = 1;
 	child->dir = prefix;
 	child->out = -1;
-	if (start_command(child))
+	if (repo_start_command(repo, child))
 		die("could not obtain raw diff");
 	fp = xfdopen(child->out, "r");
 
diff --git a/odb.c b/odb.c
index 776de5356c..8ec279f84e 100644
--- a/odb.c
+++ b/odb.c
@@ -535,7 +535,7 @@ static void read_alternate_refs(struct repository *repo,
 
 	fill_alternate_refs_command(repo, &cmd, path);
 
-	if (start_command(&cmd))
+	if (repo_start_command(repo, &cmd))
 		return;
 
 	fh = xfdopen(cmd.out, "r");
diff --git a/pager.c b/pager.c
index 5531fff50e..9a23ed958d 100644
--- a/pager.c
+++ b/pager.c
@@ -169,7 +169,7 @@ void setup_pager(struct repository *r)
 	prepare_pager_args(&pager_process, pager);
 	pager_process.in = -1;
 	strvec_push(&pager_process.env, "GIT_PAGER_IN_USE");
-	if (start_command(&pager_process))
+	if (repo_start_command(r, &pager_process))
 		die("unable to execute pager '%s'", pager);
 
 	/* original process continues, but writes to the pipe */
diff --git a/repack-promisor.c b/repack-promisor.c
index 90318ce150..dba161a11a 100644
--- a/repack-promisor.c
+++ b/repack-promisor.c
@@ -125,7 +125,7 @@ void pack_geometry_repack_promisors(struct repository *repo,
 	prepare_pack_objects(&cmd, args, packtmp);
 	strvec_push(&cmd.args, "--stdin-packs");
 	cmd.in = -1;
-	if (start_command(&cmd))
+	if (repo_start_command(repo, &cmd))
 		die(_("could not start pack-objects to repack promisor packs"));
 
 	in = xfdopen(cmd.in, "w");
diff --git a/send-pack.c b/send-pack.c
index 67d6987b1c..c339c3d1ca 100644
--- a/send-pack.c
+++ b/send-pack.c
@@ -92,7 +92,7 @@ static int pack_objects(struct repository *r,
 	po.out = args->stateless_rpc ? -1 : fd;
 	po.git_cmd = 1;
 	po.clean_on_exit = 1;
-	if (start_command(&po))
+	if (repo_start_command(r, &po))
 		die_errno("git pack-objects failed");
 
 	/*
@@ -459,7 +459,7 @@ static void get_commons_through_negotiation(struct repository *r,
 		return;
 	}
 
-	if (start_command(&child))
+	if (repo_start_command(r, &child))
 		die(_("send-pack: unable to fork off fetch subprocess"));
 
 	do {
-- 
2.53.0
Previous: Burak Kaan KaraçayNext: Junio C Hamano
Message 3 of 18 in “wean start_command() off the_repository”
  1. 0/4 wean start_command() off the_repositoryBurak Kaan Karaçay, Mar 11, 2026
  2. 1/4 run-command: add repo_start_command()Burak Kaan Karaçay, Mar 11, 2026
  3. 2/4 run-command: use repo_start_command() in strict callersBurak Kaan Karaçay, Mar 11, 2026
  4. Junio C HamanoMar 11, 2026
  5. 3/4 run-command: redefine start_command() as a wrapper macroBurak Kaan Karaçay, Mar 11, 2026
  6. 4/4 cocci: convert start_command() to repo_start_command()Burak Kaan Karaçay, Mar 11, 2026
  7. René ScharfeMar 11, 2026
  8. Jeff KingMar 11, 2026
  9. Burak Kaan KaraçayMar 11, 2026
  10. Junio C HamanoMar 11, 2026
  11. Junio C HamanoMar 11, 2026
  12. run-command: wean start_command() off the_repositoryBurak Kaan Karaçay, Mar 12, 2026
  13. Patrick SteinhardtMar 12, 2026
  14. 0/2 run-command: stop using the_repositoryBurak Kaan Karaçay, Mar 12, 2026
  15. 1/2 run-command: wean start_command() off the_repositoryBurak Kaan Karaçay, Mar 12, 2026
  16. 2/2 run-command: wean auto_maintenance() functions off the_repositoryBurak Kaan Karaçay, Mar 12, 2026
  17. Junio C HamanoMar 12, 2026
  18. Patrick SteinhardtMar 13, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.