[PATCH v3 2/9] ref-filter: add option to filter only tags
- From
Karthik Nayak <karthik.188@gmail.com>
- Date
- Jul 18, 2015, 19:12 UTC
- Message-ID
- <1437246749-14423-3-git-send-email-Karthik.188@gmail.com>
- In-Reply-To
- <1437246749-14423-1-git-send-email-Karthik.188@gmail.com>
From: Karthik Nayak <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 <christian.couder@gmail.com> Mentored-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr> Signed-off-by: Karthik Nayak <karthik.188@gmail.com> --- ref-filter.c | 2 ++ ref-filter.h | 1 + 2 files changed, 3 insertions(+)
diff --git a/ref-filter.c b/ref-filter.c index b81a08d..771c48d 100644 --- a/ref-filter.c +++ b/ref-filter.c @@ -1149,6 +1149,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 12ffbc5..c18781b 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.6