@@ -8,6 +8,7 @@ use error_stack::{Report, Result, ResultExt};
88use fast_glob:: glob_match;
99use ignore:: { DirEntry , WalkBuilder , WalkParallel , WalkState } ;
1010use rayon:: iter:: { IntoParallelIterator , ParallelIterator } ;
11+ use serde:: Deserialize ;
1112use tracing:: { instrument, warn} ;
1213
1314use crate :: {
@@ -61,7 +62,7 @@ impl<'a> ProjectBuilder<'a> {
6162 // Prune traversal early: skip heavy and irrelevant directories
6263 let ignore_dirs = self . config . ignore_dirs . clone ( ) ;
6364 let base_path = self . base_path . clone ( ) ;
64- let untracked_files = if skip_untracked_files_config_path_exists ( & self . base_path , & self . config . skip_untracked_files_config_path ) {
65+ let untracked_files = if should_skip_untracked_files ( & self . base_path , & self . config . codeowners_override_config_file_path ) {
6566 files:: untracked_files ( & base_path) . unwrap_or_default ( )
6667 } else {
6768 vec ! [ ]
@@ -297,10 +298,24 @@ fn matches_globs(path: &Path, globs: &[String]) -> bool {
297298 }
298299}
299300
300- // If skip_untracked_files_config_path exists, we skip untracked files. We don't do this be default because it's slow.
301- fn skip_untracked_files_config_path_exists ( base_path : & Path , skip_untracked_files_config_path : & str ) -> bool {
302- let path = base_path. join ( skip_untracked_files_config_path) ;
303- path. exists ( )
301+ fn should_skip_untracked_files ( base_path : & Path , codeowners_override_config_file_path : & str ) -> bool {
302+ let path = base_path. join ( codeowners_override_config_file_path) ;
303+ if let Ok ( file) = File :: open ( path) {
304+ #[ derive( Deserialize ) ]
305+ struct OverrideConfig {
306+ #[ serde( default ) ]
307+ skip_untracked_files : bool ,
308+ }
309+
310+ let config: OverrideConfig = match serde_yaml:: from_reader ( file) {
311+ Ok ( cfg) => cfg,
312+ Err ( _) => return false ,
313+ } ;
314+
315+ return config. skip_untracked_files ;
316+ }
317+
318+ false
304319}
305320
306321fn ruby_package_owner ( path : & Path ) -> Result < Option < String > , Error > {
0 commit comments