summaryrefslogtreecommitdiff
path: root/include/git2/branch.h
diff options
context:
space:
mode:
authornulltoken <emeric.fermas@gmail.com>2012-07-20 16:19:04 +0200
committernulltoken <emeric.fermas@gmail.com>2012-07-24 16:09:44 +0200
commiteed378b66960414942ac78840afbcb19bfffbf15 (patch)
tree9cbd2dc1bceb60e725515c1bd5637549e88a1200 /include/git2/branch.h
parentb308c11e4ee7d05df4906e04b4008615f41e069c (diff)
downloadlibgit2-eed378b66960414942ac78840afbcb19bfffbf15.tar.gz
branch: introduce git_branch_lookup()
Diffstat (limited to 'include/git2/branch.h')
-rw-r--r--include/git2/branch.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/include/git2/branch.h b/include/git2/branch.h
index 7442ece03..fb30aaa26 100644
--- a/include/git2/branch.h
+++ b/include/git2/branch.h
@@ -117,6 +117,30 @@ GIT_EXTERN(int) git_branch_move(
const char *new_branch_name,
int force);
+/**
+ * Lookup a branch by its name in a repository.
+ *
+ * The generated reference must be freed by the user.
+ *
+ * @param branch_out pointer to the looked-up branch reference
+ *
+ * @param repo the repository to look up the branch
+ *
+ * @param branch_name Name of the branch to be looked-up;
+ * this name is validated for consistency.
+ *
+ * @param branch_type Type of the considered branch. This should
+ * be valued with either GIT_BRANCH_LOCAL or GIT_BRANCH_REMOTE.
+ *
+ * @return 0 on success; GIT_ENOTFOUND when no matching branch
+ * exists, otherwise an error code.
+ */
+GIT_EXTERN(int) git_branch_lookup(
+ git_reference **branch_out,
+ git_repository *repo,
+ const char *branch_name,
+ git_branch_t branch_type);
+
/** @} */
GIT_END_DECL
#endif