diff options
author | Jeff King <peff@peff.net> | 2019-03-20 08:16:14 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-03-20 09:34:09 (GMT) |
commit | 0f804b0bac39fb696ea74b8dd59549935ec9ca00 (patch) | |
tree | 394d187c972446e54d13da8f85873e9fbe9a3f81 | |
parent | c5c33504c906f6bf09fe00a1a32c6c4bdb76ed0f (diff) | |
download | git-0f804b0bac39fb696ea74b8dd59549935ec9ca00.zip git-0f804b0bac39fb696ea74b8dd59549935ec9ca00.tar.gz git-0f804b0bac39fb696ea74b8dd59549935ec9ca00.tar.bz2 |
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>
-rw-r--r-- | builtin/fetch-pack.c | 2 | ||||
-rw-r--r-- | fetch-pack.c | 3 | ||||
-rw-r--r-- | fetch-pack.h | 3 | ||||
-rw-r--r-- | transport.c | 10 |
4 files changed, 7 insertions, 11 deletions
diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c index 153a2bd..dc1485c 100644 --- a/builtin/fetch-pack.c +++ b/builtin/fetch-pack.c @@ -234,7 +234,7 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix) BUG("unknown protocol version"); } - ref = fetch_pack(&args, fd, conn, ref, dest, sought, nr_sought, + ref = fetch_pack(&args, fd, ref, sought, nr_sought, &shallow, pack_lockfile_ptr, version); if (pack_lockfile) { printf("lock %s\n", pack_lockfile); diff --git a/fetch-pack.c b/fetch-pack.c index e69993b..8d67d4e 100644 --- a/fetch-pack.c +++ b/fetch-pack.c @@ -1615,9 +1615,8 @@ static int iterate_ref_map(void *cb_data, struct object_id *oid) } struct ref *fetch_pack(struct fetch_pack_args *args, - int fd[], struct child_process *conn, + int fd[], const struct ref *ref, - const char *dest, struct ref **sought, int nr_sought, struct oid_array *shallow, char **pack_lockfile, diff --git a/fetch-pack.h b/fetch-pack.h index 43ec344..67f6842 100644 --- a/fetch-pack.h +++ b/fetch-pack.h @@ -78,9 +78,8 @@ struct fetch_pack_args { * marked as such. */ struct ref *fetch_pack(struct fetch_pack_args *args, - int fd[], struct child_process *conn, + int fd[], const struct ref *ref, - const char *dest, struct ref **sought, int nr_sought, struct oid_array *shallow, diff --git a/transport.c b/transport.c index d0608df..365ea57 100644 --- a/transport.c +++ b/transport.c @@ -314,7 +314,6 @@ static int fetch_refs_via_pack(struct transport *transport, int ret = 0; struct git_transport_data *data = transport->data; struct ref *refs = NULL; - char *dest = xstrdup(transport->url); struct fetch_pack_args args; struct ref *refs_tmp = NULL; @@ -356,16 +355,16 @@ static int fetch_refs_via_pack(struct transport *transport, switch (data->version) { case protocol_v2: - refs = fetch_pack(&args, data->fd, data->conn, + refs = fetch_pack(&args, data->fd, refs_tmp ? refs_tmp : transport->remote_refs, - dest, to_fetch, nr_heads, &data->shallow, + to_fetch, nr_heads, &data->shallow, &transport->pack_lockfile, data->version); break; case protocol_v1: case protocol_v0: - refs = fetch_pack(&args, data->fd, data->conn, + refs = fetch_pack(&args, data->fd, refs_tmp ? refs_tmp : transport->remote_refs, - dest, to_fetch, nr_heads, &data->shallow, + to_fetch, nr_heads, &data->shallow, &transport->pack_lockfile, data->version); break; case protocol_unknown_version: @@ -389,7 +388,6 @@ static int fetch_refs_via_pack(struct transport *transport, free_refs(refs_tmp); free_refs(refs); - free(dest); return ret; } |