Skip to content

Commit a8b6589

Browse files
committed
change!: Easier access to local and remote branches (#364)
1 parent df24f16 commit a8b6589

File tree

1 file changed

+14
-2
lines changed
  • git-repository/src/reference

1 file changed

+14
-2
lines changed

git-repository/src/reference/iter.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,28 @@ impl<'r> Platform<'r> {
5757
}
5858

5959
// TODO: tests
60-
/// Return an iterator over all branches.
60+
/// Return an iterator over all local branches.
6161
///
6262
/// They are all prefixed with `refs/heads`.
63-
pub fn branches(&self) -> Result<Iter<'_>, init::Error> {
63+
pub fn local_branches(&self) -> Result<Iter<'_>, init::Error> {
6464
Ok(Iter {
6565
inner: self.platform.prefixed("refs/heads/")?,
6666
peel: false,
6767
repo: self.repo,
6868
})
6969
}
70+
71+
// TODO: tests
72+
/// Return an iterator over all remote branches.
73+
///
74+
/// They are all prefixed with `refs/remotes`.
75+
pub fn remote_branches(&self) -> Result<Iter<'_>, init::Error> {
76+
Ok(Iter {
77+
inner: self.platform.prefixed("refs/remotes/")?,
78+
peel: false,
79+
repo: self.repo,
80+
})
81+
}
7082
}
7183

7284
impl<'r> Iter<'r> {

0 commit comments

Comments
 (0)