Skip to content

Commit 71e3d9a

Browse files
author
Stephan Dilly
committed
get_commit_diff on commit with unknown parent (#836)
1 parent 29f71f5 commit 71e3d9a

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
## Fixed
1111
- do not allow to ignore .gitignore files ([#825](https://github.com/extrawurst/gitui/issues/825))
12+
- crash in shallow repo ([#836](https://github.com/extrawurst/gitui/issues/836))
1213

1314
## [0.16.2] - 2021-07-10
1415

asyncgit/src/sync/commit_files.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ pub(crate) fn get_commit_diff(
4949
let commit = repo.find_commit(id.into())?;
5050
let commit_tree = commit.tree()?;
5151
let parent = if commit.parent_count() > 0 {
52-
Some(repo.find_commit(commit.parent_id(0)?)?.tree()?)
52+
repo.find_commit(commit.parent_id(0)?)
53+
.ok()
54+
.and_then(|c| c.tree().ok())
5355
} else {
5456
None
5557
};

0 commit comments

Comments
 (0)