@@ -286,13 +286,14 @@ impl Info {
286
286
disabled : InfoFieldOn ,
287
287
bold_flag : bool ,
288
288
custom_image : Option < DynamicImage > ,
289
+ no_merges : bool ,
289
290
) -> Result < Info > {
290
- let authors = Info :: get_authors ( & dir, 3 ) ;
291
+ let authors = Info :: get_authors ( & dir, no_merges , 3 ) ;
291
292
let ( git_v, git_user) = Info :: get_git_info ( & dir) ;
292
293
let current_commit_info = Info :: get_current_commit_info ( & dir) ?;
293
294
let config = Info :: get_configuration ( & dir) ?;
294
295
let version = Info :: get_version ( & dir) ?;
295
- let commits = Info :: get_commits ( & dir) ?;
296
+ let commits = Info :: get_commits ( & dir, no_merges ) ?;
296
297
let repo_size = Info :: get_packed_size ( & dir) ?;
297
298
let last_change = Info :: get_last_change ( & dir) ?;
298
299
let creation_date = Info :: get_creation_time ( dir) ?;
@@ -325,12 +326,14 @@ impl Info {
325
326
}
326
327
327
328
// Return first n most active commiters as authors within this project.
328
- fn get_authors ( dir : & str , n : usize ) -> Vec < ( String , usize , usize ) > {
329
+ fn get_authors ( dir : & str , no_merges : bool , n : usize ) -> Vec < ( String , usize , usize ) > {
330
+ let mut args = vec ! [ "-C" , dir, "log" , "--format='%aN'" ] ;
331
+ if no_merges {
332
+ args. push ( "--no-merges" ) ;
333
+ }
334
+
329
335
let output = Command :: new ( "git" )
330
- . arg ( "-C" )
331
- . arg ( dir)
332
- . arg ( "log" )
333
- . arg ( "--format='%aN'" )
336
+ . args ( args)
334
337
. output ( )
335
338
. expect ( "Failed to execute git." ) ;
336
339
@@ -468,13 +471,15 @@ impl Info {
468
471
}
469
472
}
470
473
471
- fn get_commits ( dir : & str ) -> Result < String > {
474
+ fn get_commits ( dir : & str , no_merges : bool ) -> Result < String > {
475
+ let mut args = vec ! [ "-C" , dir, "rev-list" , "--count" ] ;
476
+ if no_merges {
477
+ args. push ( "--no-merges" ) ;
478
+ }
479
+ args. push ( "HEAD" ) ;
480
+
472
481
let output = Command :: new ( "git" )
473
- . arg ( "-C" )
474
- . arg ( dir)
475
- . arg ( "rev-list" )
476
- . arg ( "--count" )
477
- . arg ( "HEAD" )
482
+ . args ( args)
478
483
. output ( )
479
484
. expect ( "Failed to execute git." ) ;
480
485
0 commit comments