summaryrefslogtreecommitdiff
path: root/remote.c
diff options
context:
space:
mode:
authorFelipe Contreras <felipe.contreras@gmail.com>2012-02-23 00:43:40 +0200
committerJunio C Hamano <gitster@pobox.com>2012-02-22 16:08:05 -0800
commit676552464a871564835e1cb9d0484277b1b75e79 (patch)
tree3cbe2d676881adf92a43b262dfdc992833e87b6e /remote.c
parentdb70a04cbb343a58e7be93e7f581d049cf901b26 (diff)
downloadgit-676552464a871564835e1cb9d0484277b1b75e79.tar.gz
remote: refactor code into alloc_delete_ref()
Will be useful in next patches. No functional changes. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'remote.c')
-rw-r--r--remote.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/remote.c b/remote.c
index 4b06a11732..c3cf736600 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);