From cda69f481db510e2a3f0ca8a0f4b54123c799416 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Sun, 18 Nov 2007 02:13:10 -0500 Subject: [PATCH] make "find_ref_by_name" a public function This was a static in remote.c, but is generally useful. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- cache.h | 2 ++ refs.c | 8 ++++++++ remote.c | 8 -------- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/cache.h b/cache.h index 6ccb764229..8d601dd6f7 100644 --- 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 aff02cd09d..387c588c74 100644 --- 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; +} diff --git a/remote.c b/remote.c index 09b7aad525..bb01059083 100644 --- 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) -- 2.11.4.GIT