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 коммит произвёл Junio C Hamano
Родитель ebc5da3208
Коммит e7e0f26eb6
3 изменённых файлов: 3 добавлений и 6 удалений

Просмотреть файл

@ -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
Просмотреть файл

@ -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
Просмотреть файл

@ -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,