Skip to content

Commit

Permalink
Working basic trie
Browse files Browse the repository at this point in the history
  • Loading branch information
Greg Soltis authored and Greg Soltis committed Apr 2, 2024
1 parent b4f569b commit 93d74a7
Show file tree
Hide file tree
Showing 5 changed files with 383 additions and 129 deletions.
27 changes: 27 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions crates/turborepo-filewatch/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ anyhow = { workspace = true }
dashmap = { workspace = true }
futures = { version = "0.3.26" }
itertools = { workspace = true }
nibble_vec = "0.1.0"
notify = { workspace = true }
radix_trie = "0.2.1"
thiserror = "1.0.38"
tokio = { workspace = true, features = ["full", "time"] }
tracing = "0.1.37"
Expand Down
18 changes: 17 additions & 1 deletion crates/turborepo-filewatch/src/globwatcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,25 @@ impl GlobSet {
Ok(Self {
include,
exclude,
exclude_raw: BTreeSet::from_iter(raw_excludes.into_iter()),
exclude_raw: BTreeSet::from_iter(raw_excludes),
})
}

pub fn from_raw_unfiltered(raw: Vec<String>) -> Result<Self, GlobError> {
let (includes, excludes): (Vec<_>, Vec<_>) = {
let mut includes = vec![];
let mut excludes = vec![];
for pattern in raw {
if let Some(exclude) = pattern.strip_prefix("!") {
excludes.push(exclude.to_string());
} else {
includes.push(pattern);
}
}
(includes, excludes)
};
Self::from_raw(includes, excludes)
}
}

#[derive(Debug, Error)]
Expand Down

0 comments on commit 93d74a7

Please sign in to comment.