git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Tor Arne Vestbø" <tor.arne.vestbo@nokia.com>
To: gitster@pobox.com
Cc: git@vger.kernel.org, Johannes.Schindelin@gmx.de
Subject: [PATCH v3 1/2] Move find_ref_by_name_abbrev to refs.c so it can be used globally
Date: Fri, 27 Mar 2009 18:45:12 +0100	[thread overview]
Message-ID: <1238175913-19175-2-git-send-email-tor.arne.vestbo@nokia.com> (raw)
In-Reply-To: <1238175913-19175-1-git-send-email-tor.arne.vestbo@nokia.com>

Signed-off-by: Tor Arne Vestbø <tor.arne.vestbo@nokia.com>
---
 cache.h  |    1 +
 refs.c   |   10 ++++++++++
 remote.c |   10 ----------
 3 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/cache.h b/cache.h
index f48e80b..23699a8 100644
--- a/cache.h
+++ b/cache.h
@@ -815,6 +815,7 @@ struct ref {
 #define REF_TAGS	(1u << 2)
 
 extern struct ref *find_ref_by_name(const struct ref *list, const char *name);
+extern struct ref *find_ref_by_name_abbrev(const struct ref *list, const char *name);
 
 #define CONNECT_VERBOSE       (1u << 0)
 extern struct child_process *git_connect(int fd[2], const char *url, const char *prog, int flags);
diff --git a/refs.c b/refs.c
index 26b0014..161e053 100644
--- a/refs.c
+++ b/refs.c
@@ -1644,3 +1644,13 @@ struct ref *find_ref_by_name(const struct ref *list, const char *name)
 			return (struct ref *)list;
 	return NULL;
 }
+
+struct ref *find_ref_by_name_abbrev(const struct ref *list, const char *name)
+{
+	for ( ; list; list = list->next) {
+		if (refname_match(name, list->name, ref_fetch_rules))
+			return (struct ref *)list;
+	}
+	return NULL;
+}
+
diff --git a/remote.c b/remote.c
index e5d6b10..e903b39 100644
--- a/remote.c
+++ b/remote.c
@@ -1220,16 +1220,6 @@ static struct ref *get_expanded_map(const struct ref *remote_refs,
 	return ret;
 }
 
-static const struct ref *find_ref_by_name_abbrev(const struct ref *refs, const char *name)
-{
-	const struct ref *ref;
-	for (ref = refs; ref; ref = ref->next) {
-		if (refname_match(name, ref->name, ref_fetch_rules))
-			return ref;
-	}
-	return NULL;
-}
-
 struct ref *get_remote_ref(const struct ref *remote_refs, const char *name)
 {
 	const struct ref *ref = find_ref_by_name_abbrev(remote_refs, name);
-- 
1.6.2.GIT

  reply	other threads:[~2009-03-27 17:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-27 17:45 [PATCH v3 0/2] git-clone: Add new option --branch to override initial branch Tor Arne Vestbø
2009-03-27 17:45 ` Tor Arne Vestbø [this message]
2009-03-27 17:45 ` [PATCH v3 2/2] " Tor Arne Vestbø

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=1238175913-19175-2-git-send-email-tor.arne.vestbo@nokia.com \
    --to=tor.arne.vestbo@nokia.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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).