From e121b9cb5f358c9779e02a2bf96fc545a896ab13 Mon Sep 17 00:00:00 2001 From: Michael Haggerty Date: Mon, 20 Mar 2017 17:33:08 +0100 Subject: refs_ref_iterator_begin(): new function Extract a new function from `do_for_each_ref()`. It will be useful elsewhere. Signed-off-by: Michael Haggerty Signed-off-by: Junio C Hamano --- refs/refs-internal.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'refs/refs-internal.h') diff --git a/refs/refs-internal.h b/refs/refs-internal.h index 6ee9f20dbc..545989ae7f 100644 --- a/refs/refs-internal.h +++ b/refs/refs-internal.h @@ -335,6 +335,17 @@ struct ref_iterator *empty_ref_iterator_begin(void); */ int is_empty_ref_iterator(struct ref_iterator *ref_iterator); +/* + * Return an iterator that goes over each reference in `refs` for + * which the refname begins with prefix. If trim is non-zero, then + * trim that many characters off the beginning of each refname. flags + * can be DO_FOR_EACH_INCLUDE_BROKEN to include broken references in + * the iteration. + */ +struct ref_iterator *refs_ref_iterator_begin( + struct ref_store *refs, + const char *prefix, int trim, int flags); + /* * A callback function used to instruct merge_ref_iterator how to * interleave the entries from iter0 and iter1. The function should -- cgit v1.2.3