Code

make "find_ref_by_name" a public function
authorJeff King <peff@peff.net>
Sun, 18 Nov 2007 07:13:10 +0000 (02:13 -0500)
committerJunio C Hamano <gitster@pobox.com>
Sun, 18 Nov 2007 10:34:34 +0000 (02:34 -0800)
This was a static in remote.c, but is generally useful.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
cache.h
refs.c
remote.c

diff --git a/cache.h b/cache.h
index 6ccb76422961d900094792f418d6309ffd9bc4e8..8d601dd6f79d75b8c3b8ac65a56f73cf9b20cedf 100644 (file)
--- a/cache.h
+++ b/cache.h
@@ -514,6 +514,8 @@ struct ref {
 #define REF_HEADS      (1u << 1)
 #define REF_TAGS       (1u << 2)
 
+extern struct ref *find_ref_by_name(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);
 extern int finish_connect(struct child_process *conn);
diff --git a/refs.c b/refs.c
index aff02cd09d4e40b04f6764a6f6ab43240b736a08..387c588c743704665756379d7ac1f0610752c0fb 100644 (file)
--- a/refs.c
+++ b/refs.c
@@ -1445,3 +1445,11 @@ int update_ref(const char *action, const char *refname,
        }
        return 0;
 }
+
+struct ref *find_ref_by_name(struct ref *list, const char *name)
+{
+       for ( ; list; list = list->next)
+               if (!strcmp(list->name, name))
+                       return list;
+       return NULL;
+}
index 09b7aad525e5916ea46d35b6ea253f716b2a2d85..bb010590837fd6ea188e64c5263bb1fe12ab93f4 100644 (file)
--- a/remote.c
+++ b/remote.c
@@ -696,14 +696,6 @@ static int match_explicit_refs(struct ref *src, struct ref *dst,
        return -errs;
 }
 
-static struct ref *find_ref_by_name(struct ref *list, const char *name)
-{
-       for ( ; list; list = list->next)
-               if (!strcmp(list->name, name))
-                       return list;
-       return NULL;
-}
-
 static const struct refspec *check_pattern_match(const struct refspec *rs,
                                                 int rs_nr,
                                                 const struct ref *src)