Skip to content

Commit e7e0f26

Browse files
rsahlberggitster
authored andcommitted
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 <[email protected]> Reviewed-by: Jonathan Nieder <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ebc5da3 commit e7e0f26

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

builtin/fsck.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -481,11 +481,6 @@ static int fsck_handle_reflog(const char *logname, const unsigned char *sha1, in
481481
return 0;
482482
}
483483

484-
static int is_branch(const char *refname)
485-
{
486-
return !strcmp(refname, "HEAD") || starts_with(refname, "refs/heads/");
487-
}
488-
489484
static int fsck_handle_ref(const char *refname, const unsigned char *sha1, int flag, void *cb_data)
490485
{
491486
struct object *obj;

refs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2810,7 +2810,7 @@ static int log_ref_write(const char *refname, const unsigned char *old_sha1,
28102810
return 0;
28112811
}
28122812

2813-
static int is_branch(const char *refname)
2813+
int is_branch(const char *refname)
28142814
{
28152815
return !strcmp(refname, "HEAD") || starts_with(refname, "refs/heads/");
28162816
}

refs.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ extern int repack_without_refs(const char **refnames, int n);
137137

138138
extern int ref_exists(const char *);
139139

140+
extern int is_branch(const char *refname);
141+
140142
/*
141143
* If refname is a non-symbolic reference that refers to a tag object,
142144
* and the tag can be (recursively) dereferenced to a non-tag object,

0 commit comments

Comments
 (0)