refs.c: add a public is_branch function

Both refs.c and fsck.c have their own private copies of the is_branch function.
Delete the is_branch function from fsck.c and make the version in refs.c
public.

Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Ronnie Sahlberg 2014-07-15 16:02:38 -07:00 committed by Junio C Hamano
parent ebc5da3208
commit e7e0f26eb6
3 changed files with 3 additions and 6 deletions

View File

@ -481,11 +481,6 @@ static int fsck_handle_reflog(const char *logname, const unsigned char *sha1, in
return 0;
}
static int is_branch(const char *refname)
{
return !strcmp(refname, "HEAD") || starts_with(refname, "refs/heads/");
}
static int fsck_handle_ref(const char *refname, const unsigned char *sha1, int flag, void *cb_data)
{
struct object *obj;

2
refs.c
View File

@ -2810,7 +2810,7 @@ static int log_ref_write(const char *refname, const unsigned char *old_sha1,
return 0;
}
static int is_branch(const char *refname)
int is_branch(const char *refname)
{
return !strcmp(refname, "HEAD") || starts_with(refname, "refs/heads/");
}

2
refs.h
View File

@ -137,6 +137,8 @@ extern int repack_without_refs(const char **refnames, int n);
extern int ref_exists(const char *);
extern int is_branch(const char *refname);
/*
* If refname is a non-symbolic reference that refers to a tag object,
* and the tag can be (recursively) dereferenced to a non-tag object,