Number of repos now only show repos with at least 1 commit visible in the heatmap instead of all the checked ones

master
Wynd 2024-08-24 15:47:15 +03:00
parent 9bc5c6174c
commit a7ef30e412
1 changed files with 9 additions and 1 deletions

View File

@ -214,6 +214,7 @@ fn get_commits(args: CliArgs, start_date: NaiveDate) -> Result<(usize, Vec<Commi
let start_date = Local.from_local_datetime(&start_date).unwrap(); let start_date = Local.from_local_datetime(&start_date).unwrap();
let authors = args.authors.unwrap_or_default(); let authors = args.authors.unwrap_or_default();
let mut repos_count = 0;
for (i, repo_path) in repos.iter().enumerate() { for (i, repo_path) in repos.iter().enumerate() {
let repo = gix::open(repo_path).unwrap(); let repo = gix::open(repo_path).unwrap();
@ -229,6 +230,7 @@ fn get_commits(args: CliArgs, start_date: NaiveDate) -> Result<(usize, Vec<Commi
} }
let mailmap = Mailmap::new(repo_path); let mailmap = Mailmap::new(repo_path);
let mut has_commits = false;
for branch in branches { for branch in branches {
let branch_commits = repo let branch_commits = repo
@ -280,6 +282,8 @@ fn get_commits(args: CliArgs, start_date: NaiveDate) -> Result<(usize, Vec<Commi
return None; return None;
} }
has_commits = true;
Some(Commit { Some(Commit {
id: c.id, id: c.id,
title, title,
@ -291,6 +295,10 @@ fn get_commits(args: CliArgs, start_date: NaiveDate) -> Result<(usize, Vec<Commi
commits.insert(c); commits.insert(c);
}); });
} }
if has_commits {
repos_count += 1;
}
} }
let commits = commits let commits = commits
@ -298,5 +306,5 @@ fn get_commits(args: CliArgs, start_date: NaiveDate) -> Result<(usize, Vec<Commi
.sorted_by_cached_key(|a| Reverse(a.time)) .sorted_by_cached_key(|a| Reverse(a.time))
.collect_vec(); .collect_vec();
Ok((repos.len(), commits)) Ok((repos_count, commits))
} }