Skip to content

Commit

Permalink
Always use the current connection's remote ref list in git protocol
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Daniel Barkalow authored and Junio C Hamano committed Feb 29, 2008
1 parent 7435982 commit 00183cb
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions transport.c
Original file line number Diff line number Diff line change
@@ -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,22 +635,22 @@ 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]);
if (finish_connect(data->conn))
refs = NULL;
data->conn = NULL;

free_refs(refs_tmp);

for (i = 0; i < nr_heads; i++)
free(origh[i]);
free(origh);

0 comments on commit 00183cb

Please sign in to comment.