From cbb5d07cb40d61376fd5ed10245da7dd35fc3155 Mon Sep 17 00:00:00 2001 From: Wynd Date: Sat, 17 Aug 2024 23:59:44 +0300 Subject: [PATCH] Added a --no-merges flag so merges can be ignored --- README.md | 3 +++ src/cli.rs | 3 +++ src/main.rs | 7 +++++++ 3 files changed, 13 insertions(+) diff --git a/README.md b/README.md index b064275..bb690f3 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,9 @@ $ git-heatmap -r "/path/to/repo" -b "main" -r "/other/repo" -b "test" # or to comply with the same number of branch lists per repo lists rule from above $ git-heatmap -r "/path/to/repo" -b "main" -r "other/repo" -b "" +# by default merges are counted so using --no-merges ensures they won't be counted +$ git-heatmap --no-merges + # filter by one or multiple authors # without an -a flag all authors will be checked $ git-heatmap -a "username" -a "other" diff --git a/src/cli.rs b/src/cli.rs index d34f833..4d79ef1 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -28,6 +28,9 @@ pub struct CliArgs { #[arg(long("until"))] pub until: Option, + + #[arg(long("no-merges"), default_value_t = false)] + pub no_merges: bool, } fn get_since_date() -> String { diff --git a/src/main.rs b/src/main.rs index e84cf46..4900dbc 100644 --- a/src/main.rs +++ b/src/main.rs @@ -193,6 +193,13 @@ fn get_commits(args: CliArgs, start_date: NaiveDate) -> Result<(usize, Vec 1; + if is_merge { + return None; + } + } + let author = c.author().ok()?; let email = author.email.to_string();