Skip to content

Commit 9ba9533

Browse files
committed
use mailmap bindings
1 parent 0130a25 commit 9ba9533

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/onefetch/info.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ impl Info {
221221
let number_of_branches = internal_repo.get_number_of_branches()?;
222222
let creation_date = internal_repo.get_creation_date(config.iso_time)?;
223223
let number_of_commits = internal_repo.get_number_of_commits();
224-
let authors = internal_repo.get_authors(config.number_of_authors, config.show_email);
224+
let authors = internal_repo.get_authors(config.number_of_authors, config.show_email)?;
225225
let last_change = internal_repo.get_date_of_last_commit(config.iso_time);
226226
let (repo_size, file_count) = internal_repo.get_repo_size();
227227
let workdir = internal_repo.get_work_dir()?;

src/onefetch/repo.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,13 @@ impl<'a> Repo<'a> {
6767
&self,
6868
n: usize,
6969
show_email: bool,
70-
) -> Vec<(String, Option<String>, usize, usize)> {
70+
) -> Result<Vec<(String, Option<String>, usize, usize)>> {
7171
let mut authors = std::collections::HashMap::new();
7272
let mut author_name_by_email = std::collections::HashMap::new();
7373
let mut total_nbr_of_commits = 0;
74+
let mailmap = self.repo.mailmap()?;
7475
for commit in &self.logs {
75-
let author = commit.author();
76+
let author = commit.author_with_mailmap(&mailmap)?;
7677
let author_name = String::from_utf8_lossy(author.name_bytes()).into_owned();
7778
let author_email = String::from_utf8_lossy(author.email_bytes()).into_owned();
7879

@@ -100,7 +101,7 @@ impl<'a> Repo<'a> {
100101
})
101102
.collect();
102103

103-
authors
104+
Ok(authors)
104105
}
105106

106107
pub fn get_date_of_last_commit(&self, iso_time: bool) -> String {

0 commit comments

Comments
 (0)