Skip to content

Commit

Permalink
make "find_ref_by_name" a public function
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jeff King authored and Junio C Hamano committed Nov 18, 2007
1 parent 9f8a15c commit cda69f4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
2 changes: 2 additions & 0 deletions cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 8 additions & 0 deletions refs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
8 changes: 0 additions & 8 deletions remote.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit cda69f4

Please sign in to comment.