@@ -394,7 +394,7 @@ impl Info {
394
394
args. push ( "--no-merges" ) ;
395
395
}
396
396
397
- args. push ( "--pretty=%cr\t %an" ) ;
397
+ args. push ( "--pretty=%cr\t %ae \t % an" ) ;
398
398
399
399
let output = Command :: new ( "git" )
400
400
. args ( args)
@@ -489,10 +489,13 @@ impl Info {
489
489
490
490
fn get_authors ( git_history : & [ String ] , n : usize ) -> Vec < ( String , usize , usize ) > {
491
491
let mut authors = std:: collections:: HashMap :: new ( ) ;
492
+ let mut author_name_by_email = std:: collections:: HashMap :: new ( ) ;
492
493
let mut total_commits = 0 ;
493
494
for line in git_history {
494
- let commit_author = line. split ( '\t' ) . collect :: < Vec < _ > > ( ) [ 1 ] . to_string ( ) ;
495
- let commit_count = authors. entry ( commit_author. to_string ( ) ) . or_insert ( 0 ) ;
495
+ let author_email = line. split ( '\t' ) . collect :: < Vec < _ > > ( ) [ 1 ] . to_string ( ) ;
496
+ let author_name = line. split ( '\t' ) . collect :: < Vec < _ > > ( ) [ 2 ] . to_string ( ) ;
497
+ let commit_count = authors. entry ( author_email. to_string ( ) ) . or_insert ( 0 ) ;
498
+ author_name_by_email. entry ( author_email. to_string ( ) ) . or_insert ( author_name) ;
496
499
* commit_count += 1 ;
497
500
total_commits += 1 ;
498
501
}
@@ -506,7 +509,7 @@ impl Info {
506
509
. into_iter ( )
507
510
. map ( |( author, count) | {
508
511
(
509
- author. trim_matches ( '\'' ) . to_string ( ) ,
512
+ author_name_by_email . get ( & author) . unwrap ( ) . trim_matches ( '\'' ) . to_string ( ) ,
510
513
count,
511
514
count * 100 / total_commits,
512
515
)
0 commit comments