summaryrefslogtreecommitdiff
path: root/include/git2/refs.h
diff options
context:
space:
mode:
authornulltoken <emeric.fermas@gmail.com>2012-06-22 15:51:44 +0200
committernulltoken <emeric.fermas@gmail.com>2012-06-22 21:40:24 +0200
commit527ed55448fb8fceb93837426c60bb401b8e32ab (patch)
tree22577f75f91a53044542cfebcbb2613057eeeeb5 /include/git2/refs.h
parentd046945cefc34c8caafde53e20e1a064576e587e (diff)
downloadlibgit2-527ed55448fb8fceb93837426c60bb401b8e32ab.tar.gz
references: introduce git_reference_foreach_glob()
Diffstat (limited to 'include/git2/refs.h')
-rw-r--r--include/git2/refs.h31
1 files changed, 30 insertions, 1 deletions
diff --git a/include/git2/refs.h b/include/git2/refs.h
index 2918215aa..2aa0ac267 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