refs.c: refactor to reuse ref_is_hidden()

Add new function `ref_is_matched()` to reuse `ref_is_hidden()`. Will use
this function for `receive-pack` to check commands with specific
prefixes.

Test case t5512 covered this change.

Signed-off-by: Jiang Xin <zhiyou.jx@alibaba-inc.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Jiang Xin
2020-05-18 05:40:35 -04:00
committed by Junio C Hamano
parent 64998a979c
commit fc2cadab10
2 changed files with 10 additions and 4 deletions

1
refs.h
View File

@ -727,6 +727,7 @@ int parse_hide_refs_config(const char *var, const char *value, const char *);
* parameter always points to the full ref name.
*/
int ref_is_hidden(const char *, const char *);
int ref_matches(struct string_list *, const char *, const char *);
enum ref_type {
REF_TYPE_PER_WORKTREE, /* refs inside refs/ but not shared */