Return the name of the given local or remote branch.
The name of the branch matches the definition of the name for git_branch_lookup. That is, if the returned name is given to git_branch_lookup() then the reference is returned that was given to this function.
where the pointer of branch name is stored; this is valid as long as the ref is not freed.
0 on success; otherwise an error code (e.g., if the ref is no local or remote branch).