for-each-ref: introduce filter_refs()
commit14de7fba3462aa8051bc63260fc6407aa51b8f68
authorKarthik Nayak <karthik.188@gmail.com>
Sat, 13 Jun 2015 19:37:28 +0000 (14 01:07 +0530)
committerJunio C Hamano <gitster@pobox.com>
Mon, 3 Aug 2015 17:24:07 +0000 (3 10:24 -0700)
tree79e98f99403fa32307c567bbf6ebb1ad55df5736
parentc95b758587021a0ee1a27836e7d4ce3f7d634f36
for-each-ref: introduce filter_refs()

Introduce filter_refs() which will act as an API for filtering
a set of refs. Based on the type of refs the user has requested,
we iterate through those refs and apply filters as per the
given ref_filter structure and finally store the filtered refs
in the ref_array structure.

Currently this will wrap around ref_filter_handler(). Hence,
ref_filter_handler is made file scope static.

As users of this API will no longer send a ref_filter_cbdata
structure directly, we make the elements of ref_filter_cbdata
pointers. We can now use the information given by the users
to obtain our own ref_filter_cbdata structure. Changes are made to
support the change in ref_filter_cbdata structure.

Make 'for-each-ref' use this API.

Helped-by: Junio C Hamano <gitster@pobox.com>
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>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/for-each-ref.c
ref-filter.c
ref-filter.h