Skip to content

Commit 5672098

Browse files
committed
Prevent merge author count on --no-merges
Addresses #131
1 parent efe9d70 commit 5672098

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/info.rs

+8-6
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ impl Info {
226226
custom_image: Option<DynamicImage>,
227227
no_merges: bool,
228228
) -> Result<Info> {
229-
let authors = Info::get_authors(&dir, 3);
229+
let authors = Info::get_authors(&dir, no_merges, 3);
230230
let (git_v, git_user) = Info::get_git_info(&dir);
231231
let current_commit_info = Info::get_current_commit_info(&dir)?;
232232
let config = Info::get_configuration(&dir)?;
@@ -264,12 +264,14 @@ impl Info {
264264
}
265265

266266
// Return first n most active commiters as authors within this project.
267-
fn get_authors(dir: &str, n: usize) -> Vec<(String, usize, usize)> {
267+
fn get_authors(dir: &str, no_merges: bool, n: usize) -> Vec<(String, usize, usize)> {
268+
let mut args = vec!["-C", dir, "log", "--format='%aN'"];
269+
if no_merges {
270+
args.push("--no-merges");
271+
}
272+
268273
let output = Command::new("git")
269-
.arg("-C")
270-
.arg(dir)
271-
.arg("log")
272-
.arg("--format='%aN'")
274+
.args(args)
273275
.output()
274276
.expect("Failed to execute git.");
275277

0 commit comments

Comments
 (0)