Skip to content

Commit 6817e48

Browse files
committed
Don't take risks when making assumptions about what branches point at
Addresses #635 (comment)
1 parent 633f0ce commit 6817e48

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Diff for: src/info/repo.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -106,15 +106,20 @@ impl<'a> Repo<'a> {
106106
.take(number_of_authors_to_display)
107107
.collect();
108108

109+
// This could happen if a branch pointed to non-commit object, so no traversal actually happens.
110+
let (time_of_first_commit, time_of_most_recent_commit) = time_of_first_commit
111+
.and_then(|a| time_of_most_recent_commit.map(|b| (a, b)))
112+
.unwrap_or_default();
113+
109114
drop(commit_iter);
110115
Ok(Self {
111116
repo,
112117
git2_repo,
113118
authors,
114119
total_num_authors,
115120
num_commits,
116-
time_of_first_commit: time_of_first_commit.expect("at least one commit"),
117-
time_of_most_recent_commit: time_of_most_recent_commit.expect("at least one commit"),
121+
time_of_first_commit,
122+
time_of_most_recent_commit,
118123
})
119124
}
120125

0 commit comments

Comments
 (0)