Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(turborepo): Move SCM to use vendored wax crate #5277

Merged
merged 1 commit into from
Jun 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 8 additions & 71 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion crates/turborepo-scm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ path-slash = "0.2.1"
sha1 = "0.10.5"
thiserror = { workspace = true }
turbopath = { workspace = true }
wax = "0.5.0"
wax = { workspace = true }
which = { workspace = true }

[dev-dependencies]
Expand Down
6 changes: 3 additions & 3 deletions crates/turborepo-scm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ pub enum Error {
#[error("package traversal error: {0}")]
Ignore(#[from] ignore::Error, #[backtrace] backtrace::Backtrace),
#[error("invalid glob: {0}")]
Glob(Box<wax::BuildError<'static>>, backtrace::Backtrace),
Glob(Box<wax::BuildError>, backtrace::Backtrace),
#[error(transparent)]
Walk(#[from] globwalk::WalkError),
}

impl From<wax::BuildError<'static>> for Error {
fn from(value: wax::BuildError<'static>) -> Self {
impl From<wax::BuildError> for Error {
fn from(value: wax::BuildError) -> Self {
Error::Glob(Box::new(value), Backtrace::capture())
}
}
Expand Down
12 changes: 4 additions & 8 deletions crates/turborepo-scm/src/manual.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,30 +40,26 @@ pub fn get_package_file_hashes_from_processing_gitignore<S: AsRef<str>>(
.to_slash()
.ok_or_else(|| PathError::invalid_utf8_error(exclusion.as_bytes()))?
.into_owned();
let g = Glob::new(glob.as_str())
.map(|g| g.into_owned())
.map_err(|e| e.into_owned())?;
let g = Glob::new(glob.as_str()).map(|g| g.into_owned())?;
excludes.push(g);
} else {
let glob = Path::new(pattern)
.to_slash()
.ok_or_else(|| PathError::invalid_utf8_error(pattern.as_bytes()))?
.into_owned();
let g = Glob::new(glob.as_str())
.map(|g| g.into_owned())
.map_err(|e| e.into_owned())?;
let g = Glob::new(glob.as_str()).map(|g| g.into_owned())?;
includes.push(g);
}
}
let include_pattern = if includes.is_empty() {
None
} else {
Some(any::<Glob<'static>, _>(includes)?)
Some(any(includes)?)
};
let exclude_pattern = if excludes.is_empty() {
None
} else {
Some(wax::any::<Glob<'static>, _>(excludes.into_iter())?)
Some(any(excludes.into_iter())?)
};
let walker = walker_builder
.follow_links(false)
Expand Down