Filter missing watches before hashing

This commit is contained in:
Bryan Bennett 2024-08-17 09:36:21 -04:00
parent efa64a4734
commit 8627db86be
No known key found for this signature in database
GPG key ID: EE149E4215408DE9
4 changed files with 14 additions and 8 deletions

View file

@ -6,9 +6,9 @@ let main = () => {
| Ok((layout_directory, flake_specifier, other_args)) =>
switch (preflight(layout_directory)) {
| Ok () =>
switch (Lib.Watches.get()) {
switch (Lib.Watches.get_extant()) {
| Ok(watches) =>
let paths = Array.map(watch => watch.path, watches);
let paths = List.map(watch => watch.path, watches);
let hash =
switch (Util.hash_files(paths)) {
| Ok(hsh) => hsh
@ -24,8 +24,8 @@ let main = () => {
| (true, true) =>
let profile_rc_mtime = Unix.stat(profile_rc).st_mtime;
let all_older =
Array.map(watch => watch.modtime, watches)
|> Array.for_all(watch_mtime =>
List.map(watch => watch.modtime, watches)
|> List.for_all(watch_mtime =>
watch_mtime <= int_of_float(profile_rc_mtime)
);
if (all_older) {