git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Barkalow <barkalow@iabervon.org>
To: Junio C Hamano <junkio@cox.net>
Cc: git@vger.kernel.org
Subject: [PATCH 2/2] Some cosmetic changes to remote library
Date: Tue, 10 Jul 2007 00:47:26 -0400 (EDT)	[thread overview]
Message-ID: <Pine.LNX.4.64.0707100045380.6977@iabervon.org> (raw)

Functions for managing ref lists were named based on their use in
match_refs (for push). For fetch, they will be used for other purposes, so 
rename them as a separate patch to make the future code readable.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
---
 remote.c |   21 +++++++++++----------
 1 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/remote.c b/remote.c
index ed39764..0b831c5 100644
--- a/remote.c
+++ b/remote.c
@@ -396,11 +396,12 @@ static int count_refspec_match(const char *pattern,
 	}
 }
 
-static void link_dst_tail(struct ref *ref, struct ref ***tail)
+static void tail_link_ref(struct ref *ref, struct ref ***tail)
 {
 	**tail = ref;
+	while (ref->next)
+		ref = ref->next;
 	*tail = &ref->next;
-	**tail = NULL;
 }
 
 static struct ref *try_explicit_object_name(const char *name)
@@ -424,16 +425,16 @@ static struct ref *try_explicit_object_name(const char *name)
 	return ref;
 }
 
-static struct ref *make_dst(const char *name, struct ref ***dst_tail)
+static struct ref *make_linked_ref(const char *name, struct ref ***tail)
 {
-	struct ref *dst;
+	struct ref *ret;
 	size_t len;
 
 	len = strlen(name) + 1;
-	dst = alloc_ref(len);
-	memcpy(dst->name, name, len);
-	link_dst_tail(dst, dst_tail);
-	return dst;
+	ret = alloc_ref(len);
+	memcpy(ret->name, name, len);
+	tail_link_ref(ret, tail);
+	return ret;
 }
 
 static int match_explicit(struct ref *src, struct ref *dst,
@@ -481,7 +482,7 @@ static int match_explicit(struct ref *src, struct ref *dst,
 		break;
 	case 0:
 		if (!memcmp(dst_value, "refs/", 5))
-			matched_dst = make_dst(dst_value, dst_tail);
+			matched_dst = make_linked_ref(dst_value, dst_tail);
 		else
 			error("dst refspec %s does not match any "
 			      "existing ref on the remote and does "
@@ -584,7 +585,7 @@ int match_refs(struct ref *src, struct ref *dst, struct ref ***dst_tail,
 			goto free_name;
 		if (!dst_peer) {
 			/* Create a new one and link it */
-			dst_peer = make_dst(dst_name, dst_tail);
+			dst_peer = make_linked_ref(dst_name, dst_tail);
 			hashcpy(dst_peer->new_sha1, src->new_sha1);
 		}
 		dst_peer->peer_ref = src;
-- 
1.5.2.2.1399.g097d5-dirty

             reply	other threads:[~2007-07-10  4:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-10  4:47 Daniel Barkalow [this message]
2007-07-10  5:33 ` [PATCH 2/2] Some cosmetic changes to remote library Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.64.0707100045380.6977@iabervon.org \
    --to=barkalow@iabervon.org \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).