summaryrefslogtreecommitdiff
path: root/include/git2
diff options
context:
space:
mode:
authornulltoken <emeric.fermas@gmail.com>2012-06-21 18:29:38 +0200
committernulltoken <emeric.fermas@gmail.com>2012-06-21 18:51:27 +0200
commita8fd805e2ff73a3825ddfe6f290774ef5a217972 (patch)
tree054d10e2bd560544fa102a62594463d5436fbf11 /include/git2
parent9311423c34bbd369928152c6a2b669204276ddd1 (diff)
downloadlibgit2-a8fd805e2ff73a3825ddfe6f290774ef5a217972.tar.gz
branch: add git_branch_foreach()
Diffstat (limited to 'include/git2')
-rw-r--r--include/git2/branch.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/include/git2/branch.h b/include/git2/branch.h
index e2432bcfc..f2239a207 100644
--- a/include/git2/branch.h
+++ b/include/git2/branch.h
@@ -96,6 +96,31 @@ GIT_EXTERN(int) git_branch_list(
unsigned int list_flags);
/**
+ * Loop over all the branches and issue a callback for each one.
+ *
+ * @param repo Repository where to find the branches.
+ *
+ * @param list_flags Filtering flags for the branch
+ * listing. Valid values are GIT_BRANCH_LOCAL, GIT_BRANCH_REMOTE
+ * or a combination of the two.
+ *
+ * @param branch_cb Callback to invoke per found branch.
+ *
+ * @param payload Extra parameter to callback function.
+ *
+ * @return 0 or an error code.
+ */
+GIT_EXTERN(int) git_branch_foreach(
+ git_repository *repo,
+ unsigned int list_flags,
+ int (*branch_cb)(
+ const char *branch_name,
+ git_branch_t branch_type,
+ void *payload),
+ void *payload
+);
+
+/**
* Move/rename an existing branch reference.
*
* @param repo Repository where lives the branch.