Skip to content

Commit 8327dae

Browse files
committed
noted a rare bug
1 parent 3608480 commit 8327dae

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

cpp-linter/src/git.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ pub fn get_diff(repo: &Repository) -> Result<git2::Diff> {
6464
}
6565
}
6666

67+
// RARE BUG when `head` is the first commit in the repo! Affects local-only runs.
68+
// > panicked at cpp-linter\src\git.rs:73:43:
69+
// > called `Result::unwrap()` on an `Err` value:
70+
// > Error { code: -3, class: 3, message: "parent 0 does not exist" }
6771
if has_staged_files {
6872
// get diff for staged files only
6973
repo.diff_tree_to_index(Some(&head), None, None)

0 commit comments

Comments
 (0)