diff options
author | Ronnie Sahlberg <sahlberg@google.com> | 2014-07-15 16:02:38 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-07-16 13:06:41 -0700 |
commit | e7e0f26eb64de205acaac63da89f47aab78ba229 (patch) | |
tree | 2f31e5198ae6e3b1d6a13f093ba8fe314b359114 | |
parent | ebc5da3208824e25a89672a3b91bd13629b215fe (diff) | |
download | git-e7e0f26eb64de205acaac63da89f47aab78ba229.tar.gz |
refs.c: add a public is_branch functionrs/unify-is-branch
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>
-rw-r--r-- | builtin/fsck.c | 5 | ||||
-rw-r--r-- | refs.c | 2 | ||||
-rw-r--r-- | refs.h | 2 |
3 files changed, 3 insertions, 6 deletions
diff --git a/builtin/fsck.c b/builtin/fsck.c index 8aadca160e..d42a27da89 100644 --- a/builtin/fsck.c +++ b/builtin/fsck.c @@ -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; @@ -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/"); } @@ -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, |