From bf031581d3d87e44da447f0e5a95bd6a24e5bf34 Mon Sep 17 00:00:00 2001 From: nulltoken Date: Mon, 14 Jan 2013 14:22:11 +0100 Subject: branch: Introduce git_branch_tracking_name() --- include/git2/branch.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'include/git2') diff --git a/include/git2/branch.h b/include/git2/branch.h index 3bda43170..70d609ebe 100644 --- a/include/git2/branch.h +++ b/include/git2/branch.h @@ -157,6 +157,30 @@ GIT_EXTERN(int) git_branch_tracking( git_reference **out, git_reference *branch); +/** + * Return the name of the reference supporting the remote tracking branch, + * given the name of a local branch reference. + * + * @param tracking_branch_name_out The user-allocated buffer which will be + * filled with the name of the reference. Pass NULL if you just want to + * get the needed size of the name of the reference as the output value. + * + * @param buffer_size Size of the `out` buffer in bytes. + * + * @param repo the repository where the branches live + * + * @param canonical_branch_name name of the local branch. + * + * @return number of characters in the reference name + * including the trailing NUL byte; GIT_ENOTFOUND when no remote tracking + * reference exists, otherwise an error code. + */ +GIT_EXTERN(int) git_branch_tracking_name( + char *tracking_branch_name_out, + size_t buffer_size, + git_repository *repo, + const char *canonical_branch_name); + /** * Determine if the current local branch is pointed at by HEAD. * -- cgit v1.2.1