From b3cd33d0792768f3a45bed850fbc884fb499388d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Sat, 6 Apr 2019 18:34:24 +0700 Subject: refs.c: add refs_ref_exists() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- refs.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'refs.c') diff --git a/refs.c b/refs.c index 142888a40a..b869f32d8b 100644 --- a/refs.c +++ b/refs.c @@ -241,9 +241,14 @@ int read_ref(const char *refname, struct object_id *oid) return read_ref_full(refname, RESOLVE_REF_READING, oid, NULL); } +static int refs_ref_exists(struct ref_store *refs, const char *refname) +{ + return !!refs_resolve_ref_unsafe(refs, refname, RESOLVE_REF_READING, NULL, NULL); +} + int ref_exists(const char *refname) { - return !!resolve_ref_unsafe(refname, RESOLVE_REF_READING, NULL, NULL); + return refs_ref_exists(get_main_ref_store(the_repository), refname); } static int match_ref_pattern(const char *refname, -- cgit v1.2.3