]> git.ipfire.org Git - thirdparty/git.git/commitdiff
refs: make refs_ref_exists public
authorHan-Wen Nienhuys <hanwen@google.com>
Fri, 21 Aug 2020 16:59:34 +0000 (16:59 +0000)
committerJunio C Hamano <gitster@pobox.com>
Fri, 21 Aug 2020 18:20:10 +0000 (11:20 -0700)
This will be necessary to replace file existence checks for pseudorefs.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
refs.c
refs.h

diff --git a/refs.c b/refs.c
index a2777793cfde5bb2324f77c23e212ca1b75eaf5b..34996fd6542a5a15a1ebd8c8e08a3f9529ac80a2 100644 (file)
--- a/refs.c
+++ b/refs.c
@@ -313,7 +313,7 @@ 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)
+int refs_ref_exists(struct ref_store *refs, const char *refname)
 {
        return !!refs_resolve_ref_unsafe(refs, refname, RESOLVE_REF_READING, NULL, NULL);
 }
diff --git a/refs.h b/refs.h
index 29e28124cd5630cba9e5f251497f2fc64b978863..04bd25019f344b72a3e05470f675dab9b4ffc19d 100644 (file)
--- a/refs.h
+++ b/refs.h
@@ -105,6 +105,8 @@ int refs_verify_refname_available(struct ref_store *refs,
                                  const struct string_list *skip,
                                  struct strbuf *err);
 
+int refs_ref_exists(struct ref_store *refs, const char *refname);
+
 int ref_exists(const char *refname);
 
 int should_autocreate_reflog(const char *refname);