diff options
author | Daniel Barkalow <barkalow@iabervon.org> | 2008-04-26 15:53:12 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-04-26 17:36:18 -0700 |
commit | be885d96fe0ebed47e637f3b0dd24fc5902f7081 (patch) | |
tree | b4c0c29c4b58ffe95c7765ebd38e6089973d7b44 /transport.c | |
parent | c13b2633f49e3e61b37973204793a4d9ef981175 (diff) | |
download | git-be885d96fe0ebed47e637f3b0dd24fc5902f7081.tar.gz |
Make ls-remote http://... list HEAD, like for git://...
This makes a struct ref able to represent a symref, and makes http.c
able to recognize one, and makes transport.c look for "HEAD" as a ref
in the list, and makes it dereference symrefs for the resulting ref,
if any.
Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'transport.c')
-rw-r--r-- | transport.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/transport.c b/transport.c index 393e0e8fe2..b012a28338 100644 --- a/transport.c +++ b/transport.c @@ -441,10 +441,14 @@ static struct ref *get_refs_via_curl(struct transport *transport) struct ref *ref = NULL; struct ref *last_ref = NULL; + struct walker *walker; + if (!transport->data) transport->data = get_http_walker(transport->url, transport->remote); + walker = transport->data; + refs_url = xmalloc(strlen(transport->url) + 11); sprintf(refs_url, "%s/info/refs", transport->url); @@ -500,6 +504,16 @@ static struct ref *get_refs_via_curl(struct transport *transport) strbuf_release(&buffer); + ref = alloc_ref(strlen("HEAD") + 1); + strcpy(ref->name, "HEAD"); + if (!walker->fetch_ref(walker, ref) && + !resolve_remote_symref(ref, refs)) { + ref->next = refs; + refs = ref; + } else { + free(ref); + } + return refs; } |