Always use the current connection's remote ref list in git protocol
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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Daniel Barkalow committed
Feb 28, 2008 at 11:10 UTC
00183cbb3d0f60852d7286e766c9b631c0c1f952
1 file changed
+5
-4
transport.c
+5
-4
@@ -622,6 +622,7 @@ static int fetch_refs_via_pack(struct transport *transport,
622
char *dest = xstrdup(transport->url);
623
struct fetch_pack_args args;
624
int i;
625
+ struct ref *refs_tmp = NULL;
626
627
memset(&args, 0, sizeof(args));
628
args.uploadpack = data->uploadpack;
@@ -634,15 +635,13 @@ static int fetch_refs_via_pack(struct transport *transport,
635
for (i = 0; i < nr_heads; i++)
636
origh[i] = heads[i] = xstrdup(to_fetch[i]->name);
637
637
- refs = transport_get_remote_refs(transport);
638
if (!data->conn) {
639
- struct ref *refs_tmp;
639
connect_setup(transport);
640
get_remote_heads(data->fd[0], &refs_tmp, 0, NULL, 0);
642
- free_refs(refs_tmp);
641
}
642
645
- refs = fetch_pack(&args, data->fd, data->conn, transport->remote_refs,
643
+ refs = fetch_pack(&args, data->fd, data->conn,
644
+ refs_tmp ? refs_tmp : transport->remote_refs,
645
dest, nr_heads, heads, &transport->pack_lockfile);
646
close(data->fd[0]);
647
close(data->fd[1]);
@@ -650,6 +649,8 @@ static int fetch_refs_via_pack(struct transport *transport,
649
refs = NULL;
650
data->conn = NULL;
651
652
+ free_refs(refs_tmp);
653
+
654
for (i = 0; i < nr_heads; i++)
655
free(origh[i]);
656
free(origh);