From c58cac12c24fbb127cf1928bec20decb007a75e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Sat, 4 May 2013 18:06:14 +0200 Subject: Introduce a glob-filtering iterator If the backend doesn't provide support for it, the matching is done in refdb on top of a normal iterator. --- include/git2/sys/refdb_backend.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'include/git2/sys') diff --git a/include/git2/sys/refdb_backend.h b/include/git2/sys/refdb_backend.h index f5eacd105..8dbf38ca9 100644 --- a/include/git2/sys/refdb_backend.h +++ b/include/git2/sys/refdb_backend.h @@ -30,10 +30,11 @@ GIT_BEGIN_DECL * ... * } * - * and assing `iter->parent.backend` to your `git_refdb_backend`. + * and assign `iter->parent.backend` to your `git_refdb_backend`. */ struct git_reference_iterator { git_refdb_backend *backend; + char *glob; }; /** An instance for a custom backend */ @@ -67,6 +68,17 @@ struct git_refdb_backend { git_reference_iterator **iter, struct git_refdb_backend *backend); + /** + * Allocate a glob-filtering iterator object for the backend. + * + * A refdb implementation may provide this function. If it's + * not available, the glob matching will be done by the frontend. + */ + int (*iterator_glob)( + git_reference_iterator **iter, + struct git_refdb_backend *backend, + const char *glob); + /** * Return the current value and advance the iterator. * -- cgit v1.2.1