git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Always use the current connection's remote ref list in git protocol

From
Daniel Barkalow <barkalow@iabervon.org>
Date
Feb 28, 2008, 16:10 UTC
Message-ID
<alpine.LNX.1.00.0802281106390.19665@iabervon.org>
In-Reply-To
<alpine.LNX.1.00.0802281026030.19665@iabervon.org>

We always report to the user the list of refs we got from the first connection, even if we do multiple connections. But we should always use each connection's own list of refs in the communication with the server, in case we got a different server out of DNS rotation or the timing was surprising or something.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
---
This should fix the same part of the problem that discarding 
transport->remote_refs did, but without having transport.c try to do 
foolish stuff and builtin-fetch need to tell it not to.
 transport.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/transport.c b/transport.c
index 397983d..fc92311 100644
--- a/transport.c
+++ b/transport.c
@@ -622,6 +622,7 @@ static int fetch_refs_via_pack(struct transport *transport,
 	char *dest = xstrdup(transport->url);
 	struct fetch_pack_args args;
 	int i;
+	struct ref *refs_tmp = NULL;
 
 	memset(&args, 0, sizeof(args));
 	args.uploadpack = data->uploadpack;
@@ -634,15 +635,13 @@ 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);
 
-	refs = transport_get_remote_refs(transport);
 	if (!data->conn) {
-		struct ref *refs_tmp;
 		connect_setup(transport);
 		get_remote_heads(data->fd[0], &refs_tmp, 0, NULL, 0);
-		free_refs(refs_tmp);
 	}
 
-	refs = fetch_pack(&args, data->fd, data->conn, transport->remote_refs,
+	refs = fetch_pack(&args, data->fd, data->conn, 
+			  refs_tmp ? refs_tmp : transport->remote_refs,
 			  dest, nr_heads, heads, &transport->pack_lockfile);
 	close(data->fd[0]);
 	close(data->fd[1]);
@@ -650,6 +649,8 @@ static int fetch_refs_via_pack(struct transport *transport,
 		refs = NULL;
 	data->conn = NULL;
 
+	free_refs(refs_tmp);
+
 	for (i = 0; i < nr_heads; i++)
 		free(origh[i]);
 	free(origh);
-- 
1.5.4.3.328.gcaed
Previous: Daniel BarkalowNext: Junio C Hamano
Message 31 of 35 in “warning: no common commits - slow pull”
  1. Len BrownFeb 11, 2008
  2. Junio C HamanoFeb 11, 2008
  3. Daniel BarkalowFeb 17, 2008
  4. Johannes SchindelinFeb 17, 2008
  5. Daniel BarkalowFeb 17, 2008
  6. Junio C HamanoFeb 17, 2008
  7. Johannes SchindelinFeb 17, 2008
  8. Daniel BarkalowFeb 17, 2008
  9. Theodore TsoFeb 11, 2008
  10. Len BrownFeb 11, 2008
  11. Junio C HamanoFeb 11, 2008
  12. Theodore TsoFeb 11, 2008
  13. Len BrownFeb 15, 2008
  14. Johannes SchindelinFeb 16, 2008
  15. Florian WeimerFeb 25, 2008
  16. Daniel BarkalowFeb 25, 2008
  17. Len BrownFeb 26, 2008
  18. Nicolas PitreFeb 26, 2008
  19. Daniel BarkalowFeb 26, 2008
  20. Junio C HamanoFeb 27, 2008
  21. Junio C HamanoFeb 27, 2008
  22. Daniel BarkalowFeb 27, 2008
  23. Junio C HamanoFeb 27, 2008
  24. Daniel BarkalowFeb 27, 2008
  25. Shawn O. PearceFeb 28, 2008
  26. Shawn O. PearceFeb 28, 2008
  27. Jon LoeligerFeb 29, 2008
  28. Daniel BarkalowFeb 29, 2008
  29. Junio C HamanoFeb 28, 2008
  30. Daniel BarkalowFeb 28, 2008
  31. Always use the current connection's remote ref list in git protocolDaniel Barkalow, Feb 28, 2008
  32. Junio C HamanoFeb 28, 2008
  33. Daniel BarkalowFeb 28, 2008
  34. Florian WeimerFeb 11, 2008
  35. NixFeb 11, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.