From: Felipe Contreras Date: Wed, 22 Feb 2012 22:43:40 +0000 (+0200) Subject: remote: refactor code into alloc_delete_ref() X-Git-Tag: v1.7.10-rc0~44^2~1 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=676552464a871564835e1cb9d0484277b1b75e79;p=git.git remote: refactor code into alloc_delete_ref() Will be useful in next patches. No functional changes. Signed-off-by: Felipe Contreras Signed-off-by: Junio C Hamano --- diff --git a/remote.c b/remote.c index 4b06a1173..c3cf73660 100644 --- a/remote.c +++ b/remote.c @@ -978,16 +978,20 @@ static void tail_link_ref(struct ref *ref, struct ref ***tail) *tail = &ref->next; } +static struct ref *alloc_delete_ref(void) +{ + struct ref *ref = alloc_ref("(delete)"); + hashclr(ref->new_sha1); + return ref; +} + static struct ref *try_explicit_object_name(const char *name) { unsigned char sha1[20]; struct ref *ref; - if (!*name) { - ref = alloc_ref("(delete)"); - hashclr(ref->new_sha1); - return ref; - } + if (!*name) + return alloc_delete_ref(); if (get_sha1(name, sha1)) return NULL; ref = alloc_ref(name);