From: Karthik Nayak Date: Thu, 09 Jul 2015 10:27:43 GMT Subject: [PATCH v2 02/10] ref-filter: add option to filter only tags Message-ID: <1436437671-25600-2-git-send-email-karthik.188@gmail.com> In-Reply-To: <1436437671-25600-1-git-send-email-karthik.188@gmail.com> Add an option in 'filter_refs()' to use 'for_each_tag_ref()' and filter refs. This type checking is done by adding a 'FILTER_REFS_TAGS' in 'ref-filter.h' Mentored-by: Christian Couder Mentored-by: Matthieu Moy Signed-off-by: Karthik Nayak --- ref-filter.c | 2 ++ ref-filter.h | 1 + 2 files changed, 3 insertions(+) diff --git a/ref-filter.c b/ref-filter.c index 3098497..e690177 100644 --- a/ref-filter.c +++ b/ref-filter.c @@ -1152,6 +1152,8 @@ int filter_refs(struct ref_array *array, struct ref_filter *filter, unsigned int ret = for_each_rawref(ref_filter_handler, &ref_cbdata); else if (type & FILTER_REFS_ALL) ret = for_each_ref(ref_filter_handler, &ref_cbdata); + else if (type & FILTER_REFS_TAGS) + ret = for_each_tag_ref(ref_filter_handler, &ref_cbdata); else if (type) die("filter_refs: invalid type"); diff --git a/ref-filter.h b/ref-filter.h index 6bf27d8..449ddb8 100644 --- a/ref-filter.h +++ b/ref-filter.h @@ -15,6 +15,7 @@ #define FILTER_REFS_INCLUDE_BROKEN 0x1 #define FILTER_REFS_ALL 0x2 +#define FILTER_REFS_TAGS 0x4 struct atom_value { const char *s; -- 2.4.5