[PATCH v2 06/12] builtin/send-pack: stop using `the_repository`
From: Usman Akinyemi <hidden>
Date: 2025-02-19 20:34:15
Subsystem:
the rest · Maintainer:
Linus Torvalds
Remove the_repository global variable in favor of the repository argument that gets passed in "builtin/send-pack.c". When `-h` is passed to the command outside a Git repository, the `run_builtin()` will call the `cmd_send_pack()` function with `repo` set to NULL and then early in the function, `parse_options()` call will give the options help and exit, without having to consult much of the configuration file. Mentored-by: Christian Couder [off-list ref] Signed-off-by: Usman Akinyemi <redacted> --- builtin/send-pack.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/builtin/send-pack.c b/builtin/send-pack.c
index 0848d23171..0ebfc98317 100644
--- a/builtin/send-pack.c
+++ b/builtin/send-pack.c@@ -1,4 +1,3 @@ -#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "config.h" #include "hex.h"
@@ -151,7 +150,7 @@ static int send_pack_config(const char *k, const char *v, int cmd_send_pack(int argc, const char **argv, const char *prefix, - struct repository *repo UNUSED) + struct repository *repo) { struct refspec rs = REFSPEC_INIT_PUSH; const char *remote_name = NULL;
@@ -221,7 +220,7 @@ int cmd_send_pack(int argc, if (!dest) usage_with_options(send_pack_usage, options); - git_config(send_pack_config, NULL); + repo_config(repo, send_pack_config, NULL); args.verbose = verbose; args.dry_run = dry_run;
@@ -318,7 +317,7 @@ int cmd_send_pack(int argc, set_ref_status_for_push(remote_refs, args.send_mirror, args.force_update); - ret = send_pack(the_repository, &args, fd, conn, remote_refs, &extra_have); + ret = send_pack(repo, &args, fd, conn, remote_refs, &extra_have); if (helper_status) print_helper_status(remote_refs);
--
2.48.1