Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions libgit2-sys/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2577,6 +2577,11 @@ extern "C" {
force: c_int,
) -> c_int;
pub fn git_branch_name(out: *mut *const c_char, branch: *const git_reference) -> c_int;
pub fn git_branch_remote_name(
out: *mut git_buf,
repo: *mut git_repository,
refname: *const c_char,
) -> c_int;
pub fn git_branch_next(
out: *mut *mut git_reference,
out_type: *mut git_branch_t,
Expand Down
10 changes: 10 additions & 0 deletions src/repo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2668,6 +2668,16 @@ impl Repository {
}
}

/// Find the remote name of a remote-tracking branch
pub fn branch_remote_name(&self, refname: &str) -> Result<Buf, Error> {
let refname = CString::new(refname)?;
unsafe {
let buf = Buf::new();
try_call!(raw::git_branch_remote_name(buf.raw(), self.raw, refname));
Ok(buf)
}
}

/// Retrieves the name of the reference supporting the remote tracking branch,
/// given the name of a local branch reference.
pub fn branch_upstream_name(&self, refname: &str) -> Result<Buf, Error> {
Expand Down