Thread (5 messages) flat view 5 messages, 1 author, 2016-06-15
DORMANTno replies

Revision v1 of 2 in this series.

Revisions (2)
  1. rfc [diff vs current]
  2. v1 current

[PATCH 3/4] remote: refactor code into alloc_delete_ref()

From: Felipe Contreras <hidden>
Date: 2016-06-15 22:53:07
Subsystem: the rest · Maintainer: Linus Torvalds

Will be useful in next patches. No functional changes.

Signed-off-by: Felipe Contreras <redacted>
---
 remote.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/remote.c b/remote.c
index 9d29acc..4709e20 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);
-- 
1.7.9.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help