From f1e212ead9d311071cb16c2dcac94f9ac3075140 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20K=C3=B6rber?= Date: Mon, 13 Jun 2022 22:47:49 +0200 Subject: [PATCH] Add function to get all remote branches --- src/repo.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/repo.rs b/src/repo.rs index b2bff1d..afda6ab 100644 --- a/src/repo.rs +++ b/src/repo.rs @@ -659,6 +659,14 @@ impl RepoHandle { .collect::, String>>() } + pub fn remote_branches(&self) -> Result, 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::, String>>() + } + pub fn fetch(&self, remote_name: &str) -> Result<(), String> { let mut remote = self .0