These functions do not depend on the backend implementation so we
can move them to the common code.

Signed-off-by: Ronnie Sahlberg <sahlb...@google.com>
---
 refs-common.c | 18 ++++++++++++++++++
 refs.c        | 18 ------------------
 2 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/refs-common.c b/refs-common.c
index ab3a118..37d3d14 100644
--- a/refs-common.c
+++ b/refs-common.c
@@ -547,3 +547,21 @@ void warn_dangling_symrefs(FILE *fp, const char *msg_fmt, 
const struct string_li
        data.msg_fmt = msg_fmt;
        for_each_rawref(warn_if_dangling_symref, &data);
 }
+
+int read_ref_full(const char *refname, unsigned char *sha1, int flags, int 
*ref_flag)
+{
+       if (resolve_ref_unsafe(refname, sha1, flags, ref_flag))
+               return 0;
+       return -1;
+}
+
+int read_ref(const char *refname, unsigned char *sha1)
+{
+       return read_ref_full(refname, sha1, RESOLVE_REF_READING, NULL);
+}
+
+int ref_exists(const char *refname)
+{
+       unsigned char sha1[20];
+       return !!resolve_ref_unsafe(refname, sha1, RESOLVE_REF_READING, NULL);
+}
diff --git a/refs.c b/refs.c
index 40c329b..a94378e 100644
--- a/refs.c
+++ b/refs.c
@@ -1514,24 +1514,6 @@ struct ref_filter {
        void *cb_data;
 };
 
-int read_ref_full(const char *refname, unsigned char *sha1, int flags, int 
*ref_flag)
-{
-       if (resolve_ref_unsafe(refname, sha1, flags, ref_flag))
-               return 0;
-       return -1;
-}
-
-int read_ref(const char *refname, unsigned char *sha1)
-{
-       return read_ref_full(refname, sha1, RESOLVE_REF_READING, NULL);
-}
-
-int ref_exists(const char *refname)
-{
-       unsigned char sha1[20];
-       return !!resolve_ref_unsafe(refname, sha1, RESOLVE_REF_READING, NULL);
-}
-
 static int filter_refs(const char *refname, const unsigned char *sha1, int 
flags,
                       void *data)
 {
-- 
2.0.1.553.geee1b3e

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to