summaryrefslogtreecommitdiff
path: root/transport.c
diff options
context:
space:
mode:
authorTay Ray Chuan <rctay89@gmail.com>2010-02-16 07:18:21 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-02-16 17:11:22 (GMT)
commitb0d66e156c5b312d468344569202d8ca4094f67f (patch)
treee4b403de21e001de39b390d74f695a0162ebf60d /transport.c
parente923eaeb901ff056421b9007adcbbce271caa7b6 (diff)
downloadgit-b0d66e156c5b312d468344569202d8ca4094f67f.zip
git-b0d66e156c5b312d468344569202d8ca4094f67f.tar.gz
git-b0d66e156c5b312d468344569202d8ca4094f67f.tar.bz2
transport: add got_remote_refs flag
transport_get_remote_refs() in tranport.c checks transport->remote_refs to determine whether transport->get_refs_list() should be invoked. The logic is "if it is NULL, we haven't run ls-remote to find out yet". However, transport->remote_refs could still be NULL while cloning from an empty repository. This causes get_refs_list() to be run unnecessarily. Introduce a flag, transport->got_remote_refs, to more explicitly record if we have run transport->get_refs_list() already. Signed-off-by: Tay Ray Chuan <rctay89@gmail.com> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'transport.c')
-rw-r--r--transport.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/transport.c b/transport.c
index 3846aac..08e4fa0 100644
--- a/transport.c
+++ b/transport.c
@@ -918,6 +918,7 @@ struct transport *transport_get(struct remote *remote, const char *url)
if (!remote)
die("No remote provided to transport_get()");
+ ret->got_remote_refs = 0;
ret->remote = remote;
helper = remote->foreign_vcs;
@@ -1079,8 +1080,10 @@ int transport_push(struct transport *transport,
const struct ref *transport_get_remote_refs(struct transport *transport)
{
- if (!transport->remote_refs)
+ if (!transport->got_remote_refs) {
transport->remote_refs = transport->get_refs_list(transport, 0);
+ transport->got_remote_refs = 1;
+ }
return transport->remote_refs;
}