From 527ed55448fb8fceb93837426c60bb401b8e32ab Mon Sep 17 00:00:00 2001 From: nulltoken Date: Fri, 22 Jun 2012 15:51:44 +0200 Subject: references: introduce git_reference_foreach_glob() --- include/git2/refs.h | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'include/git2') diff --git a/include/git2/refs.h b/include/git2/refs.h index 2918215a..2aa0ac26 100644 --- a/include/git2/refs.h +++ b/include/git2/refs.h @@ -258,7 +258,6 @@ GIT_EXTERN(int) git_reference_packall(git_repository *repo); */ GIT_EXTERN(int) git_reference_list(git_strarray *array, git_repository *repo, unsigned int list_flags); - /** * Perform an operation on each reference in the repository * @@ -324,6 +323,36 @@ GIT_EXTERN(void) git_reference_free(git_reference *ref); */ GIT_EXTERN(int) git_reference_cmp(git_reference *ref1, git_reference *ref2); +/** + * Loop over all the references and issue a callback for each one + * which name matches the given glob pattern. + * + * The processed references may be filtered by type, or using + * a bitwise OR of several types. Use the magic value + * `GIT_REF_LISTALL` to obtain all references, including + * packed ones. + * + * @param repo Repository where to find the references. + * + * @param list_flags Filtering flags for the reference + * listing. + * + * @param callback Callback to invoke per found reference. + * + * @param payload Extra parameter to callback function. + * + * @return 0 or an error code. + */ +GIT_EXTERN(int) git_reference_foreach_glob( + git_repository *repo, + const char *glob, + unsigned int list_flags, + int (*callback)( + const char *reference_name, + void *payload), + void *payload +); + /** @} */ GIT_END_DECL #endif -- cgit v1.2.1