Skip to content

Commit

Permalink
don't panic when commit not found in get_logs
Browse files Browse the repository at this point in the history
  • Loading branch information
o2sh committed Dec 15, 2020
1 parent e99c56f commit 9207c6c
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/onefetch/repo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,17 @@ impl<'a> Repo<'a> {
.filter_map(|r| match r {
Err(_) => None,
Ok(r) => {
let commit = repo.find_commit(r).expect("Could not find commit");
if no_merges {
let parents = commit.parents().len();
if parents > 1 {
return None;
if let Ok(commit) = repo.find_commit(r) {
if no_merges {
let parents = commit.parents().len();
if parents > 1 {
return None;
}
}
Some(commit)
} else {
None
}
Some(commit.to_owned())
}
})
.collect();
Expand Down

0 comments on commit 9207c6c

Please sign in to comment.