Skip to content

Commit

Permalink
Rename traverse_ignored_dirs to traverse_data_only_dirs
Browse files Browse the repository at this point in the history
Signed-off-by: Nathan Rebours <nathan.p.rebours@gmail.com>
  • Loading branch information
NathanReb committed Jul 2, 2019
1 parent c75f479 commit 1714e14
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/build_system.ml
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ module Alias0 = struct

let dep_rec_internal ~name ~dir ~ctx_dir =
Build.lazy_no_targets (lazy (
File_tree.Dir.fold dir ~traverse_ignored_dirs:false ~traverse_vendored_dirs:false
File_tree.Dir.fold dir ~traverse_data_only_dirs:false ~traverse_vendored_dirs:false
~init:(Build.return true)
~f:(fun dir acc ->
let path = Path.Build.append_source ctx_dir (File_tree.Dir.path dir) in
Expand Down Expand Up @@ -1256,7 +1256,7 @@ and get_rule t path =
let all_targets t =
String.Map.to_list t.contexts
|> List.fold_left ~init:Path.Build.Set.empty ~f:(fun acc (_, ctx) ->
File_tree.fold t.file_tree ~traverse_ignored_dirs:true ~traverse_vendored_dirs:true ~init:acc
File_tree.fold t.file_tree ~traverse_data_only_dirs:true ~traverse_vendored_dirs:true ~init:acc
~f:(fun dir acc ->
match
load_dir
Expand Down
2 changes: 1 addition & 1 deletion src/dune_load.ml
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ let interpret ~dir ~project ~ignore_promoted_rules
let load ?(ignore_promoted_rules=false) ~ancestor_vcs () =
let ftree = File_tree.load Path.Source.root ~ancestor_vcs in
let projects =
File_tree.fold ftree ~traverse_ignored_dirs:false ~traverse_vendored_dirs:true ~init:[]
File_tree.fold ftree ~traverse_data_only_dirs:false ~traverse_vendored_dirs:true ~init:[]
~f:(fun dir acc ->
let p = File_tree.Dir.project dir in
if Path.Source.equal
Expand Down
12 changes: 6 additions & 6 deletions src/file_tree.ml
Original file line number Diff line number Diff line change
Expand Up @@ -136,19 +136,19 @@ module Dir = struct
String.Map.foldi (sub_dirs t) ~init:Path.Source.Set.empty
~f:(fun s _ acc -> Path.Source.Set.add acc (Path.Source.relative t.path s))

let skip ~traverse_ignored_dirs ~traverse_vendored_dirs t =
let skip ~traverse_data_only_dirs ~traverse_vendored_dirs t =
match t.status with
| Data_only -> not traverse_ignored_dirs
| Data_only -> not traverse_data_only_dirs
| Vendored -> not traverse_vendored_dirs
| Normal -> false

let rec fold t ~traverse_ignored_dirs ~traverse_vendored_dirs ~init:acc ~f =
if skip ~traverse_ignored_dirs ~traverse_vendored_dirs t then
let rec fold t ~traverse_data_only_dirs ~traverse_vendored_dirs ~init:acc ~f =
if skip ~traverse_data_only_dirs ~traverse_vendored_dirs t then
acc
else
let acc = f t acc in
String.Map.fold (sub_dirs t) ~init:acc ~f:(fun t acc ->
fold t ~traverse_ignored_dirs ~traverse_vendored_dirs ~init:acc ~f)
fold t ~traverse_data_only_dirs ~traverse_vendored_dirs ~init:acc ~f)

let rec dyn_of_contents { files; sub_dirs; dune_file } =
let open Dyn in
Expand Down Expand Up @@ -397,7 +397,7 @@ let files_recursively_in t ~prefix_with path =
match find_dir t path with
| None -> Path.Set.empty
| Some dir ->
Dir.fold dir ~init:Path.Set.empty ~traverse_ignored_dirs:true ~traverse_vendored_dirs:true
Dir.fold dir ~init:Path.Set.empty ~traverse_data_only_dirs:true ~traverse_vendored_dirs:true
~f:(fun dir acc ->
let path = Path.append_source prefix_with (Dir.path dir) in
String.Set.fold (Dir.files dir) ~init:acc ~f:(fun fn acc ->
Expand Down
6 changes: 3 additions & 3 deletions src/file_tree.mli
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ module Dir : sig

val fold
: t
-> traverse_ignored_dirs:bool
-> traverse_data_only_dirs:bool
-> traverse_vendored_dirs:bool
-> init:'a
-> f:(t -> 'a -> 'a)
Expand All @@ -77,12 +77,12 @@ val load
-> ancestor_vcs:Vcs.t option
-> t

(** Passing [~traverse_ignored_dirs:true] to this functions causes the
(** Passing [~traverse_data_only_dirs:true] to this functions causes the
whole source tree to be deeply scanned, including ignored
sub-trees. *)
val fold
: t
-> traverse_ignored_dirs:bool
-> traverse_data_only_dirs:bool
-> traverse_vendored_dirs:bool
-> init:'a
-> f:(Dir.t -> 'a -> 'a)
Expand Down
2 changes: 1 addition & 1 deletion src/upgrader.ml
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ let upgrade ft =
; to_edit = []
}
in
File_tree.fold ft ~traverse_ignored_dirs:false ~traverse_vendored_dirs:false ~init:()
File_tree.fold ft ~traverse_data_only_dirs:false ~traverse_vendored_dirs:false ~init:()
~f:(fun dir () -> upgrade_dir todo dir);
let git = lazy (
match Bin.which ~path:(Env.path Env.initial) "git" with
Expand Down
2 changes: 1 addition & 1 deletion src/utop.ml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ let libs_under_dir sctx ~db ~dir =
(let open Option.O in
let* dir = Path.drop_build_context dir in
let+ dir = File_tree.find_dir (Super_context.file_tree sctx) dir in
File_tree.Dir.fold dir ~traverse_ignored_dirs:true ~traverse_vendored_dirs:true
File_tree.Dir.fold dir ~traverse_data_only_dirs:true ~traverse_vendored_dirs:true
~init:[] ~f:(fun dir acc ->
let dir =
Path.Build.append_source (Super_context.build_dir sctx)
Expand Down

0 comments on commit 1714e14

Please sign in to comment.