summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Barkalow <barkalow@iabervon.org>2008-02-28 16:10:51 (GMT)
committerJunio C Hamano <gitster@pobox.com>2008-02-29 08:00:29 (GMT)
commit00183cbb3d0f60852d7286e766c9b631c0c1f952 (patch)
treea31935e519b6102f6cbf3abaf831340993b4ee31
parent7435982102093179474a128648179a44042d8a1c (diff)
downloadgit-00183cbb3d0f60852d7286e766c9b631c0c1f952.zip
git-00183cbb3d0f60852d7286e766c9b631c0c1f952.tar.gz
git-00183cbb3d0f60852d7286e766c9b631c0c1f952.tar.bz2
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>
-rw-r--r--transport.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/transport.c b/transport.c
index 397983d..0a5cf0a 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);