Add methods for the head_ref* functions.

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

diff --git a/refs-common.c b/refs-common.c
index d9688e2..f19402b 100644
--- a/refs-common.c
+++ b/refs-common.c
@@ -918,3 +918,13 @@ int resolve_gitlink_ref(const char *path, const char 
*refname,
 {
        return refs->resolve_gitlink_ref(path, refname, sha1);
 }
+
+int head_ref(each_ref_fn fn, void *cb_data)
+{
+       return refs->head_ref(fn, cb_data);
+}
+
+int head_ref_submodule(const char *submodule, each_ref_fn fn, void *cb_data)
+{
+       return refs->head_ref_submodule(submodule, fn, cb_data);
+}
diff --git a/refs.c b/refs.c
index 9439809..7ad07f1 100644
--- a/refs.c
+++ b/refs.c
@@ -1600,12 +1600,12 @@ static int do_head_ref(const char *submodule, 
each_ref_fn fn, void *cb_data)
        return 0;
 }
 
-int head_ref(each_ref_fn fn, void *cb_data)
+static int files_head_ref(each_ref_fn fn, void *cb_data)
 {
        return do_head_ref(NULL, fn, cb_data);
 }
 
-int head_ref_submodule(const char *submodule, each_ref_fn fn, void *cb_data)
+static int files_head_ref_submodule(const char *submodule, each_ref_fn fn, 
void *cb_data)
 {
        return do_head_ref(submodule, fn, cb_data);
 }
@@ -3309,6 +3309,8 @@ struct ref_be refs_files = {
        files_peel_ref,
        files_create_symref,
        files_resolve_gitlink_ref,
+       files_head_ref,
+       files_head_ref_submodule,
 };
 
 struct ref_be *refs = &refs_files;
diff --git a/refs.h b/refs.h
index ab120c5..420e9b5 100644
--- a/refs.h
+++ b/refs.h
@@ -397,6 +397,10 @@ typedef int (*create_symref_fn)(const char *ref_target,
 typedef int (*resolve_gitlink_ref_fn)(const char *path, const char *refname,
                                      unsigned char *sha1);
 
+typedef int (*head_ref_fn)(each_ref_fn fn, void *cb_data);
+typedef int (*head_ref_submodule_fn)(const char *submodule, each_ref_fn fn,
+                                    void *cb_data);
+
 struct ref_be {
        transaction_begin_fn transaction_begin;
        transaction_update_sha1_fn transaction_update_sha1;
@@ -417,6 +421,8 @@ struct ref_be {
        peel_ref_fn peel_ref;
        create_symref_fn create_symref;
        resolve_gitlink_ref_fn resolve_gitlink_ref;
+       head_ref_fn head_ref;
+       head_ref_submodule_fn head_ref_submodule;
 };
 
 extern struct ref_be *refs;
-- 
2.0.1.556.g3edca4c

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