These functions do not use any backend specific code so we can move
them to the common code.

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

diff --git a/refs-be-files.c b/refs-be-files.c
index 56e146f..40c329b 100644
--- a/refs-be-files.c
+++ b/refs-be-files.c
@@ -1667,58 +1667,6 @@ int peel_ref(const char *refname, unsigned char *sha1)
        return peel_object(base, sha1);
 }
 
-struct warn_if_dangling_data {
-       FILE *fp;
-       const char *refname;
-       const struct string_list *refnames;
-       const char *msg_fmt;
-};
-
-static int warn_if_dangling_symref(const char *refname, const unsigned char 
*sha1,
-                                  int flags, void *cb_data)
-{
-       struct warn_if_dangling_data *d = cb_data;
-       const char *resolves_to;
-       unsigned char junk[20];
-
-       if (!(flags & REF_ISSYMREF))
-               return 0;
-
-       resolves_to = resolve_ref_unsafe(refname, junk, 0, NULL);
-       if (!resolves_to
-           || (d->refname
-               ? strcmp(resolves_to, d->refname)
-               : !string_list_has_string(d->refnames, resolves_to))) {
-               return 0;
-       }
-
-       fprintf(d->fp, d->msg_fmt, refname);
-       fputc('\n', d->fp);
-       return 0;
-}
-
-void warn_dangling_symref(FILE *fp, const char *msg_fmt, const char *refname)
-{
-       struct warn_if_dangling_data data;
-
-       data.fp = fp;
-       data.refname = refname;
-       data.refnames = NULL;
-       data.msg_fmt = msg_fmt;
-       for_each_rawref(warn_if_dangling_symref, &data);
-}
-
-void warn_dangling_symrefs(FILE *fp, const char *msg_fmt, const struct 
string_list *refnames)
-{
-       struct warn_if_dangling_data data;
-
-       data.fp = fp;
-       data.refname = NULL;
-       data.refnames = refnames;
-       data.msg_fmt = msg_fmt;
-       for_each_rawref(warn_if_dangling_symref, &data);
-}
-
 /*
  * Call fn for each reference in the specified ref_cache, omitting
  * references not in the containing_dir of base.  fn is called for all
diff --git a/refs.c b/refs.c
index adf0c29..3011452 100644
--- a/refs.c
+++ b/refs.c
@@ -497,3 +497,55 @@ char *shorten_unambiguous_ref(const char *refname, int 
strict)
        free(short_name);
        return xstrdup(refname);
 }
+
+struct warn_if_dangling_data {
+       FILE *fp;
+       const char *refname;
+       const struct string_list *refnames;
+       const char *msg_fmt;
+};
+
+static int warn_if_dangling_symref(const char *refname, const unsigned char 
*sha1,
+                                  int flags, void *cb_data)
+{
+       struct warn_if_dangling_data *d = cb_data;
+       const char *resolves_to;
+       unsigned char junk[20];
+
+       if (!(flags & REF_ISSYMREF))
+               return 0;
+
+       resolves_to = resolve_ref_unsafe(refname, junk, 0, NULL);
+       if (!resolves_to
+           || (d->refname
+               ? strcmp(resolves_to, d->refname)
+               : !string_list_has_string(d->refnames, resolves_to))) {
+               return 0;
+       }
+
+       fprintf(d->fp, d->msg_fmt, refname);
+       fputc('\n', d->fp);
+       return 0;
+}
+
+void warn_dangling_symref(FILE *fp, const char *msg_fmt, const char *refname)
+{
+       struct warn_if_dangling_data data;
+
+       data.fp = fp;
+       data.refname = refname;
+       data.refnames = NULL;
+       data.msg_fmt = msg_fmt;
+       for_each_rawref(warn_if_dangling_symref, &data);
+}
+
+void warn_dangling_symrefs(FILE *fp, const char *msg_fmt, const struct 
string_list *refnames)
+{
+       struct warn_if_dangling_data data;
+
+       data.fp = fp;
+       data.refname = NULL;
+       data.refnames = refnames;
+       data.msg_fmt = msg_fmt;
+       for_each_rawref(warn_if_dangling_symref, &data);
+}
-- 
2.0.1.552.g1af257a

--
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