fetch_pack(): drop unused parameters
We don't need the caller of fetch_pack() to pass in "dest", which is the remote URL. Since ba227857d2 (Reduce the number of connects when fetching, 2008-02-04), the caller is responsible for calling git_connect() itself, and our "dest" parameter is unused. That commit also started passing us the resulting "conn" child_process from git_connect(). But likewise, we do not need do anything with it. The descriptors in "fd" are enough for us, and the caller is responsible for cleaning up "conn". We can just drop both parameters. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
Mar 20, 2019 at 04:16 UTC
0f804b0bac39fb696ea74b8dd59549935ec9ca00
4 files changed
+7
-11
builtin/fetch-pack.c
+1
-1
@@ -234,7 +234,7 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix)
234
BUG("unknown protocol version");
235
}
236
237
- ref = fetch_pack(&args, fd, conn, ref, dest, sought, nr_sought,
237
+ ref = fetch_pack(&args, fd, ref, sought, nr_sought,
238
&shallow, pack_lockfile_ptr, version);
239
if (pack_lockfile) {
240
printf("lock %s\n", pack_lockfile);
fetch-pack.c
+1
-2
@@ -1615,9 +1615,8 @@ static int iterate_ref_map(void *cb_data, struct object_id *oid)
1615
}
1616
1617
struct ref *fetch_pack(struct fetch_pack_args *args,
1618
- int fd[], struct child_process *conn,
1618
+ int fd[],
1619
const struct ref *ref,
1620
- const char *dest,
1620
struct ref **sought, int nr_sought,
1621
struct oid_array *shallow,
1622
char **pack_lockfile,
fetch-pack.h
+1
-2
@@ -78,9 +78,8 @@ struct fetch_pack_args {
78
* marked as such.
79
*/
80
struct ref *fetch_pack(struct fetch_pack_args *args,
81
- int fd[], struct child_process *conn,
81
+ int fd[],
82
const struct ref *ref,
83
- const char *dest,
83
struct ref **sought,
84
int nr_sought,
85
struct oid_array *shallow,
transport.c
+4
-6
@@ -314,7 +314,6 @@ static int fetch_refs_via_pack(struct transport *transport,
314
int ret = 0;
315
struct git_transport_data *data = transport->data;
316
struct ref *refs = NULL;
317
- char *dest = xstrdup(transport->url);
317
struct fetch_pack_args args;
318
struct ref *refs_tmp = NULL;
319
@@ -356,16 +355,16 @@ static int fetch_refs_via_pack(struct transport *transport,
355
356
switch (data->version) {
357
case protocol_v2:
359
- refs = fetch_pack(&args, data->fd, data->conn,
358
+ refs = fetch_pack(&args, data->fd,
359
refs_tmp ? refs_tmp : transport->remote_refs,
361
- dest, to_fetch, nr_heads, &data->shallow,
360
+ to_fetch, nr_heads, &data->shallow,
361
&transport->pack_lockfile, data->version);
362
break;
363
case protocol_v1:
364
case protocol_v0:
366
- refs = fetch_pack(&args, data->fd, data->conn,
365
+ refs = fetch_pack(&args, data->fd,
366
refs_tmp ? refs_tmp : transport->remote_refs,
368
- dest, to_fetch, nr_heads, &data->shallow,
367
+ to_fetch, nr_heads, &data->shallow,
368
&transport->pack_lockfile, data->version);
369
break;
370
case protocol_unknown_version:
@@ -389,7 +388,6 @@ static int fetch_refs_via_pack(struct transport *transport,
388
389
free_refs(refs_tmp);
390
free_refs(refs);
392
- free(dest);
391
return ret;
392
}
393