From: Ronnie Sahlberg <sahlb...@google.com> These functions do not depend on the backend implementation so move them to the common code.
Signed-off-by: Ronnie Sahlberg <sahlb...@google.com> Signed-off-by: David Turner <dtur...@twopensource.com> Signed-off-by: Junio C Hamano <gits...@pobox.com> Signed-off-by: Michael Haggerty <mhag...@alum.mit.edu> --- refs/files-backend.c | 18 ------------------ refs/refs.c | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 9fb77c2..6940d54 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -1803,24 +1803,6 @@ struct ref_filter { void *cb_data; }; -int read_ref_full(const char *refname, int resolve_flags, unsigned char *sha1, int *flags) -{ - if (resolve_ref_unsafe(refname, resolve_flags, sha1, flags)) - return 0; - return -1; -} - -int read_ref(const char *refname, unsigned char *sha1) -{ - return read_ref_full(refname, RESOLVE_REF_READING, sha1, NULL); -} - -int ref_exists(const char *refname) -{ - unsigned char sha1[20]; - return !!resolve_ref_unsafe(refname, RESOLVE_REF_READING, sha1, NULL); -} - static int filter_refs(const char *refname, const struct object_id *oid, int flags, void *data) { diff --git a/refs/refs.c b/refs/refs.c index 6d9ea7c..ae55d85 100644 --- a/refs/refs.c +++ b/refs/refs.c @@ -597,3 +597,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, int resolve_flags, unsigned char *sha1, int *flags) +{ + if (resolve_ref_unsafe(refname, resolve_flags, sha1, flags)) + return 0; + return -1; +} + +int read_ref(const char *refname, unsigned char *sha1) +{ + return read_ref_full(refname, RESOLVE_REF_READING, sha1, NULL); +} + +int ref_exists(const char *refname) +{ + unsigned char sha1[20]; + return !!resolve_ref_unsafe(refname, RESOLVE_REF_READING, sha1, NULL); +} -- 2.6.2 -- 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