refs: add a "for_each_replace_ref" function
authorChristian Couder <chriscool@tuxfamily.org>
Fri, 23 Jan 2009 09:06:38 +0000 (10:06 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 1 Jun 2009 00:02:59 +0000 (17:02 -0700)
This is some preparation work for the following patches that are using
the "refs/replace/" ref namespace.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
refs.c
refs.h

diff --git a/refs.c b/refs.c
index 24438c652fe4e09aaa1ba6dab283b8e59c24c1a7..6a136512c716c2169aed82107d077aad5142095c 100644 (file)
--- a/refs.c
+++ b/refs.c
@@ -667,6 +667,11 @@ int for_each_remote_ref(each_ref_fn fn, void *cb_data)
        return for_each_ref_in("refs/remotes/", fn, cb_data);
 }
 
+int for_each_replace_ref(each_ref_fn fn, void *cb_data)
+{
+       return do_for_each_ref("refs/replace/", fn, 13, 0, cb_data);
+}
+
 int for_each_rawref(each_ref_fn fn, void *cb_data)
 {
        return do_for_each_ref("refs/", fn, 0,
diff --git a/refs.h b/refs.h
index c11f6a6d588d1bd737fa60241b9c67308f4c14cc..777b5b7ca6c08ef63f44abbf0236fc180cb9c6d1 100644 (file)
--- a/refs.h
+++ b/refs.h
@@ -24,6 +24,7 @@ extern int for_each_ref_in(const char *, each_ref_fn, void *);
 extern int for_each_tag_ref(each_ref_fn, void *);
 extern int for_each_branch_ref(each_ref_fn, void *);
 extern int for_each_remote_ref(each_ref_fn, void *);
+extern int for_each_replace_ref(each_ref_fn, void *);
 
 /* can be used to learn about broken ref and symref */
 extern int for_each_rawref(each_ref_fn, void *);