| 79 | } |
| 80 | |
| 81 | pub fn walk_commits(&self) -> Result<impl Iterator<Item = Result<Commit<'_>>>> { |
| 82 | let mut revwalk = self.repo.revwalk()?; |
| 83 | revwalk.push_head()?; |
| 84 | revwalk.set_sorting(git2::Sort::TIME | git2::Sort::TOPOLOGICAL)?; |
| 85 | |
| 86 | Ok(revwalk.map(move |oid_result| match oid_result { |
| 87 | Ok(oid) => self |
| 88 | .repo |
| 89 | .find_commit(oid) |
| 90 | .map_err(VcsqlError::Git), |
| 91 | Err(e) => Err(VcsqlError::Git(e)), |
| 92 | })) |
| 93 | } |
| 94 | |
| 95 | pub fn branches(&self, branch_type: Option<BranchType>) -> Result<git2::Branches<'_>> { |
| 96 | Ok(self.repo.branches(branch_type)?) |