fetch_pack(): drop unused parameters
authorJeff King <peff@peff.net>
Wed, 20 Mar 2019 08:16:14 +0000 (04:16 -0400)
committerJunio C Hamano <gitster@pobox.com>
Wed, 20 Mar 2019 09:34:09 +0000 (18:34 +0900)
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>
builtin/fetch-pack.c
fetch-pack.c
fetch-pack.h
transport.c
index 153a2bd282cac47ba72c101eaf0ca1b867d3f2cd..dc1485c8aa1bf2b623aaa18ccd710644a34e0153 100644 (file)
@@ -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);
index e69993b2eb56885253af21b6de33fd487725e313..8d67d4e362bed29e5febd028032f67e0c94ce2d4 100644 (file)
@@ -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,
index 43ec344d95b40c701b2fc703b4b2b1e3ff72a2d2..67f684229a9ae8c852cc27138ff376d671d80f58 100644 (file)
@@ -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,
index d0608df5c90cab4d2e2a2071a7416aeac75004e1..365ea574c7b52e0fc4381295eed6650ca5f67a87 100644 (file)
@@ -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;
 }