summaryrefslogtreecommitdiff
path: root/remote.c
diff options
context:
space:
mode:
authorDaniel Barkalow <barkalow@iabervon.org>2008-04-26 19:53:12 (GMT)
committerJunio C Hamano <gitster@pobox.com>2008-04-27 00:36:18 (GMT)
commitbe885d96fe0ebed47e637f3b0dd24fc5902f7081 (patch)
treeb4c0c29c4b58ffe95c7765ebd38e6089973d7b44 /remote.c
parentc13b2633f49e3e61b37973204793a4d9ef981175 (diff)
downloadgit-be885d96fe0ebed47e637f3b0dd24fc5902f7081.zip
git-be885d96fe0ebed47e637f3b0dd24fc5902f7081.tar.gz
git-be885d96fe0ebed47e637f3b0dd24fc5902f7081.tar.bz2
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 'remote.c')
-rw-r--r--remote.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/remote.c b/remote.c
index 2d9af40..1504cd0 100644
--- a/remote.c
+++ b/remote.c
@@ -706,13 +706,22 @@ struct ref *copy_ref_list(const struct ref *ref)
return ret;
}
+void free_ref(struct ref *ref)
+{
+ if (!ref)
+ return;
+ free(ref->remote_status);
+ free(ref->symref);
+ free(ref);
+}
+
void free_refs(struct ref *ref)
{
struct ref *next;
while (ref) {
next = ref->next;
free(ref->peer_ref);
- free(ref);
+ free_ref(ref);
ref = next;
}
}
@@ -1172,3 +1181,15 @@ int get_fetch_map(const struct ref *remote_refs,
return 0;
}
+
+int resolve_remote_symref(struct ref *ref, struct ref *list)
+{
+ if (!ref->symref)
+ return 0;
+ for (; list; list = list->next)
+ if (!strcmp(ref->symref, list->name)) {
+ hashcpy(ref->old_sha1, list->old_sha1);
+ return 0;
+ }
+ return 1;
+}