summaryrefslogtreecommitdiff
path: root/remote-curl.c
diff options
context:
space:
mode:
authorLibravatar Jonathan Tan <jonathantanmy@google.com>2019-02-14 11:06:35 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2019-02-14 12:47:55 -0800
commit7d50d34fc7d9764766c13eb4f86171f241664b98 (patch)
tree3d76648f819a3c67714ce70de3589ecfb928a778 /remote-curl.c
parentGit 2.21-rc1 (diff)
downloadtgif-7d50d34fc7d9764766c13eb4f86171f241664b98.tar.xz
remote-curl: reduce scope of rpc_state.argv
The argv field in struct rpc_state is only used in rpc_service(), and not in any functions it directly or indirectly calls. Refactor it to become an argument of rpc_service() instead. Signed-off-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'remote-curl.c')
-rw-r--r--remote-curl.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/remote-curl.c b/remote-curl.c
index bb7421023b..8b7baf6298 100644
--- a/remote-curl.c
+++ b/remote-curl.c
@@ -505,7 +505,6 @@ static void output_refs(struct ref *refs)
struct rpc_state {
const char *service_name;
- const char **argv;
struct strbuf *stdin_preamble;
char *service_url;
char *hdr_content_type;
@@ -829,7 +828,8 @@ retry:
return err;
}
-static int rpc_service(struct rpc_state *rpc, struct discovery *heads)
+static int rpc_service(struct rpc_state *rpc, struct discovery *heads,
+ const char **client_argv)
{
const char *svc = rpc->service_name;
struct strbuf buf = STRBUF_INIT;
@@ -840,7 +840,7 @@ static int rpc_service(struct rpc_state *rpc, struct discovery *heads)
client.in = -1;
client.out = -1;
client.git_cmd = 1;
- client.argv = rpc->argv;
+ client.argv = client_argv;
if (start_command(&client))
exit(1);
if (preamble)
@@ -978,11 +978,10 @@ static int fetch_git(struct discovery *heads,
memset(&rpc, 0, sizeof(rpc));
rpc.service_name = "git-upload-pack",
- rpc.argv = args.argv;
rpc.stdin_preamble = &preamble;
rpc.gzip_request = 1;
- err = rpc_service(&rpc, heads);
+ err = rpc_service(&rpc, heads, args.argv);
if (rpc.result.len)
write_or_die(1, rpc.result.buf, rpc.result.len);
strbuf_release(&rpc.result);
@@ -1112,10 +1111,9 @@ static int push_git(struct discovery *heads, int nr_spec, char **specs)
memset(&rpc, 0, sizeof(rpc));
rpc.service_name = "git-receive-pack",
- rpc.argv = args.argv;
rpc.stdin_preamble = &preamble;
- err = rpc_service(&rpc, heads);
+ err = rpc_service(&rpc, heads, args.argv);
if (rpc.result.len)
write_or_die(1, rpc.result.buf, rpc.result.len);
strbuf_release(&rpc.result);