Number of commits is now accurate within both start and end times
parent
95bb51dfd4
commit
249a962441
13
src/main.rs
13
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<PathBuf>, _args: &CliA
|
|||
}
|
||||
}
|
||||
|
||||
fn get_commits(args: CliArgs, start_date: NaiveDate) -> Result<(usize, Vec<Commit>)> {
|
||||
fn get_commits(
|
||||
args: CliArgs,
|
||||
start_date: NaiveDate,
|
||||
end_date: NaiveDate,
|
||||
) -> Result<(usize, Vec<Commit>)> {
|
||||
let mut commits: HashSet<Commit> = HashSet::new();
|
||||
|
||||
let (repos, branches) = match &args.root_dir {
|
||||
|
@ -209,6 +213,9 @@ fn get_commits(args: CliArgs, start_date: NaiveDate) -> Result<(usize, Vec<Commi
|
|||
let start_date = start_date.and_time(current_time);
|
||||
let start_date = Local.from_local_datetime(&start_date).unwrap();
|
||||
|
||||
let end_date = end_date.and_time(current_time);
|
||||
let end_date = Local.from_local_datetime(&end_date).unwrap();
|
||||
|
||||
let authors = args.authors.unwrap_or_default();
|
||||
let mut repos_count = 0;
|
||||
|
||||
|
@ -274,7 +281,7 @@ fn get_commits(args: CliArgs, start_date: NaiveDate) -> Result<(usize, Vec<Commi
|
|||
let time = c.time().ok()?;
|
||||
let time =
|
||||
DateTime::from_timestamp_millis(time.seconds * 1000)?.with_timezone(&Local);
|
||||
if time <= start_date + Duration::days(1) {
|
||||
if time <= start_date + Duration::days(1) || time > end_date {
|
||||
return None;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue