public inbox for git@vger.kernel.org
 help / color / mirror / Atom feed
From: "Burak Kaan Karaçay" <bkkaracay@gmail.com>
To: git@vger.kernel.org
Cc: christian.couder@gmail.com, karthik.188@gmail.com,
	jltobler@gmail.com, ayu.chandekar@gmail.com,
	siddharthasthana31@gmail.com, l.s.r@web.de, ps@pks.im,
	"Burak Kaan Karaçay" <bkkaracay@gmail.com>
Subject: [PATCH 3/4] run-command: redefine start_command() as a wrapper macro
Date: Wed, 11 Mar 2026 18:19:22 +0300	[thread overview]
Message-ID: <20260311151923.4178655-4-bkkaracay@gmail.com> (raw)
In-Reply-To: <20260311151923.4178655-1-bkkaracay@gmail.com>

In the commit introducing 'repo_start_command()', 'start_command()' was
redefined as a wrapper function.

Now, redefine 'start_command()' as a wrapper macro to make 'the_repository'
dependency explicit at the caller's site. To successfully build, expose
'the_repository' dependency at the call sites by defining
'USE_THE_REPOSITORY_VARIABLE' or including 'repository.h' where necessary.

Signed-off-by: Burak Kaan Karaçay <bkkaracay@gmail.com>
---
 builtin/credential-cache.c  | 2 ++
 builtin/remote-ext.c        | 2 ++
 column.c                    | 1 +
 credential.c                | 1 +
 midx-write.c                | 2 ++
 prompt.c                    | 1 +
 repack-cruft.c              | 2 ++
 repack-filtered.c           | 2 ++
 repack-midx.c               | 2 ++
 repack-promisor.c           | 2 ++
 run-command.c               | 5 -----
 run-command.h               | 2 +-
 sub-process.c               | 3 +++
 t/helper/test-run-command.c | 2 ++
 14 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/builtin/credential-cache.c b/builtin/credential-cache.c
index 7f733cb756..fb17aa87ba 100644
--- a/builtin/credential-cache.c
+++ b/builtin/credential-cache.c
@@ -1,3 +1,5 @@
+#define USE_THE_REPOSITORY_VARIABLE
+
 #include "builtin.h"
 #include "credential.h"
 #include "gettext.h"
diff --git a/builtin/remote-ext.c b/builtin/remote-ext.c
index bd2037f27d..ed2d551753 100644
--- a/builtin/remote-ext.c
+++ b/builtin/remote-ext.c
@@ -1,3 +1,5 @@
+#define USE_THE_REPOSITORY_VARIABLE
+
 #include "builtin.h"
 #include "transport.h"
 #include "run-command.h"
diff --git a/column.c b/column.c
index 93fae316b4..998b2ab458 100644
--- a/column.c
+++ b/column.c
@@ -1,3 +1,4 @@
+#define USE_THE_REPOSITORY_VARIABLE
 #define DISABLE_SIGN_COMPARE_WARNINGS
 
 #include "git-compat-util.h"
diff --git a/credential.c b/credential.c
index 2594c0c422..a513355105 100644
--- a/credential.c
+++ b/credential.c
@@ -1,3 +1,4 @@
+#define USE_THE_REPOSITORY_VARIABLE
 #define DISABLE_SIGN_COMPARE_WARNINGS
 
 #include "git-compat-util.h"
diff --git a/midx-write.c b/midx-write.c
index 6485cb6706..a53f77f13a 100644
--- a/midx-write.c
+++ b/midx-write.c
@@ -1,3 +1,5 @@
+#define USE_THE_REPOSITORY_VARIABLE
+
 #include "git-compat-util.h"
 #include "abspath.h"
 #include "config.h"
diff --git a/prompt.c b/prompt.c
index 706fba2a50..20a8c34438 100644
--- a/prompt.c
+++ b/prompt.c
@@ -7,6 +7,7 @@
 #include "strbuf.h"
 #include "prompt.h"
 #include "compat/terminal.h"
+#include "repository.h"
 
 static char *do_askpass(const char *cmd, const char *prompt)
 {
diff --git a/repack-cruft.c b/repack-cruft.c
index 0653e88792..0bfc77792a 100644
--- a/repack-cruft.c
+++ b/repack-cruft.c
@@ -1,3 +1,5 @@
+#define USE_THE_REPOSITORY_VARIABLE
+
 #include "git-compat-util.h"
 #include "repack.h"
 #include "packfile.h"
diff --git a/repack-filtered.c b/repack-filtered.c
index edcf7667c5..2f5d1dd709 100644
--- a/repack-filtered.c
+++ b/repack-filtered.c
@@ -1,3 +1,5 @@
+#define USE_THE_REPOSITORY_VARIABLE
+
 #include "git-compat-util.h"
 #include "repack.h"
 #include "repository.h"
diff --git a/repack-midx.c b/repack-midx.c
index 0682b80c42..8b4c0d95e3 100644
--- a/repack-midx.c
+++ b/repack-midx.c
@@ -1,3 +1,5 @@
+#define USE_THE_REPOSITORY_VARIABLE
+
 #include "git-compat-util.h"
 #include "repack.h"
 #include "hash.h"
diff --git a/repack-promisor.c b/repack-promisor.c
index dba161a11a..70ef19d04f 100644
--- a/repack-promisor.c
+++ b/repack-promisor.c
@@ -1,3 +1,5 @@
+#define USE_THE_REPOSITORY_VARIABLE
+
 #include "git-compat-util.h"
 #include "repack.h"
 #include "hex.h"
diff --git a/run-command.c b/run-command.c
index fadc3d5283..af26c636a9 100644
--- a/run-command.c
+++ b/run-command.c
@@ -674,11 +674,6 @@ static void trace_run_command(const struct child_process *cp)
 	strbuf_release(&buf);
 }
 
-int start_command(struct child_process *cmd)
-{
-	return repo_start_command(the_repository, cmd);
-}
-
 int repo_start_command(struct repository *repo, struct child_process *cmd)
 {
 	int need_in, need_out, need_err;
diff --git a/run-command.h b/run-command.h
index 654ca659b3..890d7c5d72 100644
--- a/run-command.h
+++ b/run-command.h
@@ -206,7 +206,7 @@ char *git_shell_path(void);
  * See below for details.
  */
 
-int start_command(struct child_process *);
+#define start_command(cmd) repo_start_command(the_repository, cmd)
 int repo_start_command(struct repository *, struct child_process *);
 
 /**
diff --git a/sub-process.c b/sub-process.c
index 83bf0a0e82..ae7493eb5c 100644
--- a/sub-process.c
+++ b/sub-process.c
@@ -1,10 +1,13 @@
 /*
  * Generic implementation of background process infrastructure.
  */
+#define USE_THE_REPOSITORY_VARIABLE
+
 #include "git-compat-util.h"
 #include "sub-process.h"
 #include "sigchain.h"
 #include "pkt-line.h"
+#include "repository.h"
 
 int cmd2process_cmp(const void *cmp_data UNUSED,
 		    const struct hashmap_entry *eptr,
diff --git a/t/helper/test-run-command.c b/t/helper/test-run-command.c
index 4a56456894..dcd58f228c 100644
--- a/t/helper/test-run-command.c
+++ b/t/helper/test-run-command.c
@@ -8,6 +8,7 @@
  * published by the Free Software Foundation.
  */
 
+#define USE_THE_REPOSITORY_VARIABLE
 #define DISABLE_SIGN_COMPARE_WARNINGS
 
 #include "test-tool.h"
@@ -18,6 +19,7 @@
 #include "string-list.h"
 #include "thread-utils.h"
 #include "wildmatch.h"
+#include "repository.h"
 
 static int number_callbacks;
 static int parallel_next(struct child_process *cp,
-- 
2.53.0


  parent reply	other threads:[~2026-03-11 15:19 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-11 15:19 [PATCH 0/4] wean start_command() off the_repository Burak Kaan Karaçay
2026-03-11 15:19 ` [PATCH 1/4] run-command: add repo_start_command() Burak Kaan Karaçay
2026-03-11 15:19 ` [PATCH 2/4] run-command: use repo_start_command() in strict callers Burak Kaan Karaçay
2026-03-11 19:26   ` Junio C Hamano
2026-03-11 15:19 ` Burak Kaan Karaçay [this message]
2026-03-11 15:19 ` [PATCH 4/4] cocci: convert start_command() to repo_start_command() Burak Kaan Karaçay
2026-03-11 18:18 ` [PATCH 0/4] wean start_command() off the_repository René Scharfe
2026-03-11 18:45   ` Jeff King
2026-03-11 19:09   ` Burak Kaan Karaçay
2026-03-11 19:35   ` Junio C Hamano
2026-03-11 19:30 ` Junio C Hamano
2026-03-12  8:53 ` [PATCH v2] run-command: " Burak Kaan Karaçay
2026-03-12 10:01   ` Patrick Steinhardt
2026-03-12 14:44 ` [PATCH v3 0/2] run-command: stop using the_repository Burak Kaan Karaçay
2026-03-12 14:44   ` [PATCH v3 1/2] run-command: wean start_command() off the_repository Burak Kaan Karaçay
2026-03-12 14:44   ` [PATCH v3 2/2] run-command: wean auto_maintenance() functions " Burak Kaan Karaçay
2026-03-12 15:29   ` [PATCH v3 0/2] run-command: stop using the_repository Junio C Hamano
2026-03-13  6:23     ` Patrick Steinhardt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260311151923.4178655-4-bkkaracay@gmail.com \
    --to=bkkaracay@gmail.com \
    --cc=ayu.chandekar@gmail.com \
    --cc=christian.couder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=jltobler@gmail.com \
    --cc=karthik.188@gmail.com \
    --cc=l.s.r@web.de \
    --cc=ps@pks.im \
    --cc=siddharthasthana31@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox