Add function to get all remote branches

This commit is contained in:
2022-06-08 17:04:54 +02:00
parent a8665ae741
commit d0425e2fdb

View File

@@ -659,6 +659,14 @@ impl RepoHandle {
.collect::<Result<Vec<Branch>, String>>()
}
pub fn remote_branches(&self) -> Result<Vec<Branch>, String> {
self.0
.branches(Some(git2::BranchType::Remote))
.map_err(convert_libgit2_error)?
.map(|branch| Ok(Branch(branch.map_err(convert_libgit2_error)?.0)))
.collect::<Result<Vec<Branch>, String>>()
}
pub fn fetch(&self, remote_name: &str) -> Result<(), String> {
let mut remote = self
.0