summaryrefslogtreecommitdiff
path: root/include/git2/refs.h
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2013-03-02 19:31:03 +0100
committerCarlos Martín Nieto <cmn@dwim.me>2013-05-11 11:20:37 +0200
commit4def7035cac133607256fd91352ce54ac4548a7c (patch)
tree6956733c0ef644f9f2a6bea1e603e3fcb72fd954 /include/git2/refs.h
parentb641c00eebb3c60e8719c0dfc55dde91ca30a5d2 (diff)
downloadlibgit2-4def7035cac133607256fd91352ce54ac4548a7c.tar.gz
refs: introduce an iterator
This allows us to get a list of reference names in a loop instead of callbacks.
Diffstat (limited to 'include/git2/refs.h')
-rw-r--r--include/git2/refs.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/include/git2/refs.h b/include/git2/refs.h
index e1d425352..48ecc96e0 100644
--- a/include/git2/refs.h
+++ b/include/git2/refs.h
@@ -347,6 +347,31 @@ GIT_EXTERN(void) git_reference_free(git_reference *ref);
GIT_EXTERN(int) git_reference_cmp(git_reference *ref1, git_reference *ref2);
/**
+ * Create an iterator for the repo's references
+ *
+ * @param out pointer in which to store the iterator
+ * @param repo the repository
+ * @return 0 or an error code
+ */
+GIT_EXTERN(int) git_reference_iterator_new(git_reference_iterator **out, git_repository *repo);
+
+/**
+ * Get the next reference name
+ *
+ * @param out pointer in which to store the string
+ * @param iter the iterator
+ * @param 0, GIT_ITEROVER if there are no more; or an error code
+ */
+GIT_EXTERN(int) git_reference_next(const char **out, git_reference_iterator *iter);
+
+/**
+ * Free the iterator and its associated resources
+ *
+ * @param iter the iterator to free
+ */
+GIT_EXTERN(void) git_reference_iterator_free(git_reference_iterator *iter);
+
+/**
* Perform a callback on each reference in the repository whose name
* matches the given pattern.
*