All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: git@vger.kernel.org
Subject: [PATCH 09/13] fetch_pack(): drop unused parameters
Date: Wed, 20 Mar 2019 04:16:14 -0400	[thread overview]
Message-ID: <20190320081614.GI10403@sigill.intra.peff.net> (raw)
In-Reply-To: <20190320081258.GA5621@sigill.intra.peff.net>

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>
---
 builtin/fetch-pack.c |  2 +-
 fetch-pack.c         |  3 +--
 fetch-pack.h         |  3 +--
 transport.c          | 10 ++++------
 4 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c
index 153a2bd282..dc1485c8aa 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 e69993b2eb..8d67d4e362 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 43ec344d95..67f684229a 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 d0608df5c9..365ea574c7 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;
 }
 
-- 
2.21.0.701.g4401309e11


  parent reply	other threads:[~2019-03-20  8:16 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-20  8:12 [PATCH 0/13] more unused parameter cleanups Jeff King
2019-03-20  8:13 ` [PATCH 01/13] revision: drop some unused "revs" parameters Jeff King
2019-03-20  8:13 ` [PATCH 02/13] log: drop unused rev_info from early output Jeff King
2019-03-20  8:14 ` [PATCH 03/13] log: drop unused "len" from show_tagger() Jeff King
2019-03-20  8:14 ` [PATCH 04/13] update-index: drop unused prefix_length parameter from do_reupdate() Jeff King
2019-03-20  8:14 ` [PATCH 05/13] test-date: drop unused "now" parameter from parse_dates() Jeff King
2019-03-20  8:15 ` [PATCH 06/13] unpack-trees: drop name_entry from traverse_by_cache_tree() Jeff King
2019-03-20  8:15 ` [PATCH 07/13] unpack-trees: drop unused error_type parameters Jeff King
2019-03-20  8:15 ` [PATCH 08/13] report_path_error(): drop unused prefix parameter Jeff King
2019-03-20  8:16 ` Jeff King [this message]
2019-03-20  8:16 ` [PATCH 10/13] parse-options: drop unused ctx parameter from show_gitcomp() Jeff King
2019-03-20  8:16 ` [PATCH 11/13] pretty: drop unused "type" parameter in needs_rfc2047_encoding() Jeff King
2019-03-20  8:16 ` [PATCH 12/13] pretty: drop unused strbuf from parse_padding_placeholder() Jeff King
2019-03-20  8:16 ` [PATCH 13/13] parse_opt_ref_sorting: always use with NONEG flag Jeff King
2019-03-20 12:22   ` Martin Ågren
2019-03-20 20:22     ` Jeff King
2019-03-20  9:29 ` [PATCH 0/13] more unused parameter cleanups Junio C Hamano
2019-03-21  8:50 ` Ævar Arnfjörð Bjarmason
2019-03-21  9:44   ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190320081614.GI10403@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.