Add function to get all remote branches

This commit is contained in:
2022-06-13 22:47:49 +02:00
parent bc3001a4e6
commit f1e212ead9

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