diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2019-04-06 18:34:24 +0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-04-08 17:26:32 +0900 |
commit | b3cd33d0792768f3a45bed850fbc884fb499388d (patch) | |
tree | 181b00e195ef07b328caa32cc5883c1f4d9e4cf6 | |
parent | packfile.c: add repo_approximate_object_count() (diff) | |
download | tgif-b3cd33d0792768f3a45bed850fbc884fb499388d.tar.xz |
refs.c: add refs_ref_exists()
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r-- | refs.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -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, |