rust/hg-core/src/matchers.rs
branchstable
changeset 51566 529a655874fb
parent 51564 f5c367dc6541
child 51567 cae0be933434
--- a/rust/hg-core/src/matchers.rs	Fri Apr 12 13:48:38 2024 +0100
+++ b/rust/hg-core/src/matchers.rs	Fri Apr 12 14:09:55 2024 +0100
@@ -17,7 +17,7 @@
         PatternFileWarning, PatternResult,
     },
     utils::{
-        files::find_dirs,
+        files::{dir_ancestors, find_dirs},
         hg_path::{HgPath, HgPathBuf, HgPathError},
         Escaped,
     },
@@ -354,7 +354,7 @@
         if self.prefix && self.files.contains(directory) {
             return VisitChildrenSet::Recursive;
         }
-        let path_or_parents_in_set = find_dirs(directory)
+        let path_or_parents_in_set = dir_ancestors(directory)
             .any(|parent_dir| self.files.contains(parent_dir));
         if self.dirs.contains(directory) || path_or_parents_in_set {
             VisitChildrenSet::This
@@ -2298,7 +2298,7 @@
     #[test]
     fn test_pattern_matcher_visit_children_set() {
         let tree = make_example_tree();
-        let _pattern_dir1_glob_c =
+        let pattern_dir1_glob_c =
             PatternMatcher::new(vec![IgnorePattern::new(
                 PatternSyntax::Glob,
                 b"dir1/*.c",
@@ -2327,10 +2327,6 @@
             )])
             .unwrap()
         };
-        //        // TODO: re-enable this test when the corresponding bug is
-        // fixed        if false {
-        //            tree.check_matcher(&pattern_dir1_glob_c);
-        //        }
         let files = vec![HgPathBuf::from_bytes(b"dir/subdir/b.txt")];
         let file_dir_subdir_b = FileMatcher::new(files).unwrap();
 
@@ -2393,6 +2389,7 @@
 
         tree.check_matcher(&pattern_dir1(), 25);
         tree.check_matcher(&pattern_dir1_a, 1);
+        tree.check_matcher(&pattern_dir1_glob_c, 2);
         tree.check_matcher(&pattern_relglob_c(), 14);
         tree.check_matcher(&AlwaysMatcher, 112);
         tree.check_matcher(&NeverMatcher, 0);