File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -22,8 +22,8 @@ pub struct Config {
2222 #[ serde( default = "default_cache_directory" ) ]
2323 pub cache_directory : String ,
2424
25- #[ serde( default = "default_ignore_globs " ) ]
26- pub ignore_globs : Vec < String > ,
25+ #[ serde( default = "default_ignore_dirs " ) ]
26+ pub ignore_dirs : Vec < String > ,
2727}
2828
2929#[ allow( dead_code) ]
@@ -60,20 +60,20 @@ fn vendored_gems_path() -> String {
6060 "vendored/" . to_string ( )
6161}
6262
63- fn default_ignore_globs ( ) -> Vec < String > {
63+ fn default_ignore_dirs ( ) -> Vec < String > {
6464 vec ! [
65- "/ .cursor" . to_owned( ) ,
66- "/ .git" . to_owned( ) ,
67- "/ .idea" . to_owned( ) ,
68- "/ .vscode" . to_owned( ) ,
69- "/ .yarn" . to_owned( ) ,
70- "/ ar_doc" . to_owned( ) ,
71- "/ db" . to_owned( ) ,
72- "/ helm" . to_owned( ) ,
73- "/ log" . to_owned( ) ,
74- "/ node_modules" . to_owned( ) ,
75- "/ sorbet" . to_owned( ) ,
76- "/ tmp" . to_owned( ) ,
65+ ".cursor" . to_owned( ) ,
66+ ".git" . to_owned( ) ,
67+ ".idea" . to_owned( ) ,
68+ ".vscode" . to_owned( ) ,
69+ ".yarn" . to_owned( ) ,
70+ "ar_doc" . to_owned( ) ,
71+ "db" . to_owned( ) ,
72+ "helm" . to_owned( ) ,
73+ "log" . to_owned( ) ,
74+ "node_modules" . to_owned( ) ,
75+ "sorbet" . to_owned( ) ,
76+ "tmp" . to_owned( ) ,
7777 ]
7878}
7979
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 11pub mod cache;
22pub ( crate ) mod common_test;
33pub mod config;
4- pub ( crate ) mod ignore;
54pub mod ownership;
65pub ( crate ) mod project;
76pub mod project_builder;
Original file line number Diff line number Diff line change @@ -303,7 +303,7 @@ mod tests {
303303 unowned_globs : vec ! [ ] ,
304304 vendored_gems_path : vendored_path. to_string ( ) ,
305305 cache_directory : "tmp/cache/codeowners" . to_string ( ) ,
306- ignore_globs : vec ! [ ] ,
306+ ignore_dirs : vec ! [ ] ,
307307 }
308308 }
309309
Original file line number Diff line number Diff line change @@ -55,14 +55,18 @@ impl<'a> ProjectBuilder<'a> {
5555 builder. hidden ( false ) ;
5656 builder. follow_links ( false ) ;
5757 // Prune traversal early: skip heavy and irrelevant directories
58- let ignore_globs = self . config . ignore_globs . clone ( ) ;
58+ let ignore_dirs = self . config . ignore_dirs . clone ( ) ;
5959 let base_path = self . base_path . clone ( ) ;
6060
6161 builder. filter_entry ( move |entry : & DirEntry | {
62- if let Ok ( relative_path) = entry. path ( ) . strip_prefix ( & base_path) {
63- if let Some ( relative_path_str) = relative_path. to_str ( ) {
64- if crate :: ignore:: matches_path ( & ignore_globs, relative_path_str) {
65- return false ;
62+ let path = entry. path ( ) ;
63+ let file_name = entry. file_name ( ) . to_str ( ) . unwrap_or ( "" ) ;
64+ if let Some ( ft) = entry. file_type ( ) {
65+ if ft. is_dir ( ) {
66+ if let Ok ( rel) = path. strip_prefix ( & base_path) {
67+ if rel. components ( ) . count ( ) == 1 && ignore_dirs. iter ( ) . any ( |d| * d == file_name) {
68+ return false ;
69+ }
6670 }
6771 }
6872 }
You can’t perform that action at this time.
0 commit comments