From ac85ba50caa4f599c79f3b4beea28403381171e9 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Wed, 28 Nov 2018 13:59:28 -0500 Subject: [PATCH] Do not use regex to define default standard dirs Because regex does not work in bootstrap Signed-off-by: Rudi Grinberg --- src/file_tree.ml | 15 +++++---------- src/predicate_lang.ml | 2 ++ src/predicate_lang.mli | 2 ++ 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/file_tree.ml b/src/file_tree.ml index 95d54e5b277b..5e6d9f19c1ac 100644 --- a/src/file_tree.ml +++ b/src/file_tree.ml @@ -9,14 +9,9 @@ module Sub_dirs = struct let default = let standard_dirs = - let open Re in - [ empty - ; seq [set "._"; rep any] - ] - |> alt - |> Glob.of_re - |> Predicate_lang.of_glob - |> Predicate_lang.compl + Predicate_lang.of_pred (function + | "" -> false + | s -> s.[0] <> '.' && s.[0] <> '_') in { sub_dirs = standard_dirs ; data_only = Predicate_lang.empty @@ -28,7 +23,7 @@ module Sub_dirs = struct let sub_dirs = Option.value sub_dirs ~default:default.sub_dirs in Predicate_lang.diff sub_dirs ignored_sub_dirs in - let data_only = Option.value data_only ~default:default.sub_dirs in + let data_only = Option.value data_only ~default:default.data_only in { sub_dirs ; data_only } let ignore_dirs t ~dirs = @@ -343,7 +338,7 @@ let load ?(extra_ignored_subtrees=Path.Set.empty) path = | Ignored -> (false, data_only) | Data_only -> (true, true) in - if is_subdir then + if not is_subdir then acc else let dirs_visited = diff --git a/src/predicate_lang.ml b/src/predicate_lang.ml index 4bdb1ec43ef4..5c08ee4c4e78 100644 --- a/src/predicate_lang.ml +++ b/src/predicate_lang.ml @@ -109,6 +109,8 @@ let union t = Ast.Union t let of_glob g = Ast.Element (Glob.test g) +let of_pred p = Ast.Element p + let of_string_set s = Ast.Element (String.Set.mem s) let compl t = Ast.Compl t diff --git a/src/predicate_lang.mli b/src/predicate_lang.mli index 364bb2380e53..a1af719c30c3 100644 --- a/src/predicate_lang.mli +++ b/src/predicate_lang.mli @@ -12,6 +12,8 @@ val filter : t -> standard:t -> string list -> string list val of_glob : Glob.t -> t +val of_pred : (string -> bool) -> t + val compl : t -> t val union : t list -> t