@@ -48,6 +48,8 @@ pub fn traverse_commit_graph(
4848
4949 let ( churn_thread, churn_tx) = get_churn_channel (
5050 repo,
51+ & mailmap,
52+ no_bots. clone ( ) ,
5153 & has_commit_graph_traversal_ended,
5254 & total_number_of_commits,
5355 max_churn_pool_size,
@@ -169,20 +171,27 @@ type ChurnPair = (NumberOfCommitsByFilepath, usize);
169171
170172fn get_churn_channel (
171173 repo : & gix:: Repository ,
174+ mailmap : & gix:: mailmap:: Snapshot ,
175+ bot_regex_pattern : Option < MyRegex > ,
172176 has_commit_graph_traversal_ended : & Arc < AtomicBool > ,
173177 total_number_of_commits : & Arc < AtomicUsize > ,
174178 max_churn_pool_size : Option < usize > ,
175179) -> Result < ( JoinHandle < Result < ChurnPair > > , Sender < ObjectId > ) > {
176180 let ( tx, rx) = channel :: < gix:: hash:: ObjectId > ( ) ;
177181 let thread = std:: thread:: spawn ( {
178182 let repo = repo. clone ( ) ;
183+ let mailmap = mailmap. clone ( ) ;
184+ let bot_regex_pattern = bot_regex_pattern. clone ( ) ;
179185 let has_commit_graph_traversal_ended = has_commit_graph_traversal_ended. clone ( ) ;
180186 let total_number_of_commits = total_number_of_commits. clone ( ) ;
181187 move || -> Result < _ > {
182188 let mut number_of_commits_by_file_path = NumberOfCommitsByFilepath :: new ( ) ;
183189 let mut number_of_diffs_computed = 0 ;
184190 while let Ok ( commit_id) = rx. recv ( ) {
185191 let commit = repo. find_object ( commit_id) ?. into_commit ( ) ;
192+ if is_bot_commit ( & commit, & mailmap, bot_regex_pattern. as_ref ( ) ) ? {
193+ continue ;
194+ }
186195 compute_diff_with_parent ( & mut number_of_commits_by_file_path, & commit, & repo) ?;
187196 number_of_diffs_computed += 1 ;
188197 if should_break (
@@ -272,6 +281,19 @@ fn compute_diff_with_parent(
272281 Ok ( ( ) )
273282}
274283
284+ fn is_bot_commit (
285+ commit : & Commit ,
286+ mailmap : & gix:: mailmap:: Snapshot ,
287+ bot_regex_pattern : Option < & MyRegex > ,
288+ ) -> Result < bool > {
289+ if bot_regex_pattern. is_some ( ) {
290+ let sig = mailmap. resolve ( commit. author ( ) ?) ;
291+ Ok ( is_bot ( & sig. name , bot_regex_pattern) )
292+ } else {
293+ Ok ( false )
294+ }
295+ }
296+
275297fn is_bot ( author_name : & BString , bot_regex_pattern : Option < & MyRegex > ) -> bool {
276298 bot_regex_pattern. map_or ( false , |regex| {
277299 regex. 0 . is_match ( author_name. to_str_lossy ( ) . as_ref ( ) )
0 commit comments