diff --git a/fs-index/src/utils.rs b/fs-index/src/utils.rs index 6a14e976..96f3be6b 100644 --- a/fs-index/src/utils.rs +++ b/fs-index/src/utils.rs @@ -78,14 +78,6 @@ pub(crate) fn discover_paths>( ) -> Result> { log::debug!("Discovering paths at root path: {:?}", root_path.as_ref()); - // Print files in the root directory - for entry in WalkDir::new(&root_path) { - let entry = entry.unwrap(); - println!("WalkDir Entry: {:?}", entry.path()); - // type - println!("\t\tFile type: {:?}", entry.file_type()); - } - // Same but min_depth(1) to skip the root directory for entry in WalkDir::new(&root_path).min_depth(1) { let entry = entry.unwrap(); @@ -95,12 +87,17 @@ pub(crate) fn discover_paths>( } // same but filter_entry(should_index) to skip hidden files - for entry in WalkDir::new(&root_path) - .min_depth(1) - .into_iter() - .filter_entry(should_index) - { + for entry in WalkDir::new(&root_path).min_depth(1).into_iter() { let entry = entry.unwrap(); + // Ignore entries that don't pass the should_index filter + if !should_index(&entry) { + println!( + "WalkDir Entry (filter_entry(should_index)): {:?}", + entry.path() + ); + continue; + } + println!( "WalkDir Entry (filter_entry(should_index)): {:?}", entry.path()