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 16, 2024
1 parent 0c1eaff commit b4a0015
Show file tree
Hide file tree
Showing 5 changed files with 500 additions and 163 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.

3 changes: 3 additions & 0 deletions crates/turborepo-filewatch/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ workspace = true

[dependencies]
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
20 changes: 19 additions & 1 deletion crates/turborepo-filewatch/src/globwatcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,27 @@ impl GlobSet {
Ok(Self {
include,
exclude,
exclude_raw: BTreeSet::from_iter(raw_excludes.into_iter()),
exclude_raw: BTreeSet::from_iter(raw_excludes),
})
}

// delegates to from_raw, but filters the globs into inclusions and exclusions
// first
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
Loading

0 comments on commit b4a0015

Please sign in to comment.