libgit2

git_branch_upstream_name

Version:

Return the name of the reference supporting the remote tracking branch, given the name of a local branch reference.

Signature

int git_branch_upstream_name(char *tracking_branch_name_out, size_t buffer_size, git_repository *repo, const char *canonical_branch_name);

Parameters

char *
In
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.

size_t
In
buffer_size

Size of the out buffer in bytes.

In
repo

the repository where the branches live

const char *
In
canonical_branch_name

name of the local branch.

Returns

int

number of characters in the reference name including the trailing NUL byte; GIT_ENOTFOUND when no remote tracking reference exists, otherwise an error code.

Versions