Thread (25 messages) flat view 25 messages, 4 authors, 2016-06-15
DORMANTno replies

[PATCH 1/2] transport: cleanup duplicated ref fetching code

From: Jeff King <hidden>
Date: 2016-06-15 22:46:12
Subsystem: the rest · Maintainer: Linus Torvalds

When fetching refs through the git protocol, the
fetch_refs_via_pack will establish the connection and get
the ref list if it has not already been done.

Since the code is only two lines, it was done inline rather
than calling the transport's get_refs function. However,
calling that function better matches the intent, and is
future-proof against enhancements in get_refs_via_connect.

Signed-off-by: Jeff King <redacted>
---
Enhancements like the one that is coming in the next patch.

Though I think that fetch_pack doesn't currently care if the HEAD symref
is set up, it makes sense to me to be consistent.

 transport.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/transport.c b/transport.c
index 9ad4a16..c9f31f6 100644
--- a/transport.c
+++ b/transport.c
@@ -646,10 +646,8 @@ static int fetch_refs_via_pack(struct transport *transport,
 	for (i = 0; i < nr_heads; i++)
 		origh[i] = heads[i] = xstrdup(to_fetch[i]->name);
 
-	if (!data->conn) {
-		connect_setup(transport);
-		get_remote_heads(data->fd[0], &refs_tmp, 0, NULL, 0, NULL);
-	}
+	if (!data->conn)
+		refs_tmp = transport->get_refs_list(transport);
 
 	refs = fetch_pack(&args, data->fd, data->conn,
 			  refs_tmp ? refs_tmp : transport->remote_refs,
-- 
1.6.2.rc0.258.gcef3.dirty
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help