From 249a9624417ba8591dbb1a4d1f66b72a7092210b Mon Sep 17 00:00:00 2001 From: Wynd Date: Sun, 1 Sep 2024 11:15:58 +0300 Subject: [PATCH] Number of commits is now accurate within both start and end times --- src/main.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index c11e1a3..65ed544 100644 --- a/src/main.rs +++ b/src/main.rs @@ -91,7 +91,7 @@ fn main() -> Result<()> { let split_months = args.split_months; - let commits = get_commits(args, since).with_context(|| "Could not fetch commit list")?; + let commits = get_commits(args, since, until).with_context(|| "Could not fetch commit list")?; let heatmap = Heatmap::new(since, until, commits.0, commits.1, split_months); @@ -176,7 +176,11 @@ fn find_git_repos(scan_path: &path::Path, repos: &mut Vec, _args: &CliA } } -fn get_commits(args: CliArgs, start_date: NaiveDate) -> Result<(usize, Vec)> { +fn get_commits( + args: CliArgs, + start_date: NaiveDate, + end_date: NaiveDate, +) -> Result<(usize, Vec)> { let mut commits: HashSet = HashSet::new(); let (repos, branches) = match &args.root_dir { @@ -209,6 +213,9 @@ fn get_commits(args: CliArgs, start_date: NaiveDate) -> Result<(usize, Vec Result<(usize, Vec end_date { return None; }