diff --git a/src/cli/run.rs b/src/cli/run.rs index f2ba736..641c730 100644 --- a/src/cli/run.rs +++ b/src/cli/run.rs @@ -96,9 +96,14 @@ pub(crate) async fn run( install_hooks(&non_skipped, printer).await?; drop(lock); - let filenames = all_filenames(hook_stage, from_ref, to_ref, all_files, files).await?; + let filenames = all_filenames(hook_stage, from_ref, to_ref, all_files, files) + .await? + .into_iter() + .map(normalize_path) + .collect::>(); + let filenames = filter_filenames( - filenames.par_iter().map(normalize_path), + filenames.par_iter(), project.config().files.as_deref(), project.config().exclude.as_deref(), )? diff --git a/src/fs.rs b/src/fs.rs index 68ee0c0..bd88a44 100644 --- a/src/fs.rs +++ b/src/fs.rs @@ -20,7 +20,6 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -use std::borrow::Cow; use std::fmt::Display; use std::path::{Path, PathBuf}; use std::sync::LazyLock; @@ -186,7 +185,7 @@ pub fn copy_dir_all(src: impl AsRef, dst: impl AsRef) -> std::io::Re /// Normalizes a path to use `/` as a separator everywhere, even on platforms /// that recognize other characters as separators. #[cfg(unix)] -pub(crate) fn normalize_path(path: Cow<'_, [u8]>) -> Cow<'_, [u8]> { +pub(crate) fn normalize_path(path: String) -> String { // UNIX only uses /, so we're good. path } @@ -194,14 +193,14 @@ pub(crate) fn normalize_path(path: Cow<'_, [u8]>) -> Cow<'_, [u8]> { /// Normalizes a path to use `/` as a separator everywhere, even on platforms /// that recognize other characters as separators. #[cfg(not(unix))] -pub(crate) fn normalize_path(mut path: Cow<[u8]>) -> Cow<[u8]> { +pub(crate) fn normalize_path(mut path: String) -> String { use std::path::is_separator; for i in 0..path.len() { if path[i] == b'/' || !is_separator(char::from(path[i])) { continue; } - path.to_mut()[i] = b'/'; + path[i] = b'/'; } path }