Skip to content

Commit 2edd7ee

Browse files
authored
Merge pull request #159 from acunniffe/fix/single-commit-commit-ranges
fix history for single commit ranges
2 parents fb276dc + 8800353 commit 2edd7ee

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/git/repository.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,15 @@ impl<'a> IntoIterator for CommitRange<'a> {
199199
type IntoIter = CommitRangeIterator<'a>;
200200

201201
fn into_iter(self) -> Self::IntoIter {
202+
// ie for single commit branches
203+
if self.start_oid == self.end_oid {
204+
return CommitRangeIterator {
205+
repo: self.repo,
206+
commit_oids: vec![self.end_oid.clone()],
207+
index: 0,
208+
};
209+
}
210+
202211
// Use git rev-list to get all commits between start and end
203212
// Format: start_oid..end_oid means commits reachable from end_oid but not from start_oid
204213
let mut args = self.repo.global_args_for_exec();

0 commit comments

Comments
 (0)