[PATCH v3 22/44] refs-be-files.c: add method for for_each_reftype_...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add method for for_each_reftype_fullpath.

Signed-off-by: David Turner <dturner@xxxxxxxxxxxxxxxx>
---
 refs-be-files.c | 11 +++++++++++
 refs.c          |  7 +++++++
 refs.h          |  3 +++
 3 files changed, 21 insertions(+)

diff --git a/refs-be-files.c b/refs-be-files.c
index 2e2399e..c99319f 100644
--- a/refs-be-files.c
+++ b/refs-be-files.c
@@ -1914,6 +1914,16 @@ static int files_for_each_replace_ref(each_ref_fn fn, void *cb_data)
 			       strlen(git_replace_ref_base), 0, cb_data);
 }
 
+static int files_for_each_reftype_fullpath(each_ref_fn fn, char *type,
+					   unsigned int broken, void *cb_data)
+{
+	unsigned int flag = 0;
+
+	if (broken)
+		flag = DO_FOR_EACH_INCLUDE_BROKEN;
+	return do_for_each_ref(&ref_cache, type, fn, 0, flag, cb_data);
+}
+
 static int files_for_each_namespaced_ref(each_ref_fn fn, void *cb_data)
 {
 	struct strbuf buf = STRBUF_INIT;
@@ -3652,4 +3662,5 @@ struct ref_be refs_be_files = {
 	files_for_each_rawref,
 	files_for_each_namespaced_ref,
 	files_for_each_replace_ref,
+	files_for_each_reftype_fullpath,
 };
diff --git a/refs.c b/refs.c
index 657ab73..e627d74 100644
--- a/refs.c
+++ b/refs.c
@@ -1105,3 +1105,10 @@ int for_each_replace_ref(each_ref_fn fn, void *cb_data)
 {
 	return the_refs_backend->for_each_replace_ref(fn, cb_data);
 }
+
+int for_each_reftype_fullpath(each_ref_fn fn, char *type, unsigned int broken,
+			      void *cb_data)
+{
+	return the_refs_backend->for_each_reftype_fullpath(fn, type, broken,
+							   cb_data);
+}
diff --git a/refs.h b/refs.h
index 6dec0da..491aa1d 100644
--- a/refs.h
+++ b/refs.h
@@ -653,6 +653,8 @@ typedef int for_each_ref_in_submodule_fn(const char *submodule,
 typedef int for_each_rawref_fn(each_ref_fn fn, void *cb_data);
 typedef int for_each_namespaced_ref_fn(each_ref_fn fn, void *cb_data);
 typedef int for_each_replace_ref_fn(each_ref_fn fn, void *cb_data);
+typedef int for_each_reftype_fullpath_fn(each_ref_fn fn, char *type,
+					 unsigned int broken, void *cb_data);
 
 struct ref_be {
 	struct ref_be *next;
@@ -674,6 +676,7 @@ struct ref_be {
 	for_each_rawref_fn *for_each_rawref;
 	for_each_namespaced_ref_fn *for_each_namespaced_ref;
 	for_each_replace_ref_fn *for_each_replace_ref;
+	for_each_reftype_fullpath_fn *for_each_reftype_fullpath;
 };
 
 
-- 
2.4.2.644.g97b850b-twtrsrc

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



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]