From be885d96fe0ebed47e637f3b0dd24fc5902f7081 Mon Sep 17 00:00:00 2001 From: Daniel Barkalow Date: Sat, 26 Apr 2008 15:53:12 -0400 Subject: 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 Signed-off-by: Junio C Hamano --- remote.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'remote.c') diff --git a/remote.c b/remote.c index 2d9af4023..1504cd01e 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; +} -- cgit v1.2.1