Skip to content

Commit

Permalink
remote: refactor code into alloc_delete_ref()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
felipec authored and gitster committed Feb 23, 2012
1 parent db70a04 commit 6765524
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions remote.c
Expand Up @@ -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);
Expand Down

0 comments on commit 6765524

Please sign in to comment.