Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
--global authored and --global committed Jun 21, 2023
1 parent 462e731 commit a1ebb43
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion crates/turborepo-cache/src/cache_archive/restore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ pub fn canonicalize_name(name: &Path) -> Result<AnchoredSystemPathBuf, CacheErro
{
if !windows_safe {
return Err(CacheError::WindowsUnsafeName(
name.to_string_lossy().to_string(),
name.to_string(),
Backtrace::capture(),
));
}
Expand Down
4 changes: 2 additions & 2 deletions crates/turborepo-cache/src/cache_archive/restore_directory.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::{backtrace::Backtrace, ffi::OsString, fs};
use std::{backtrace::Backtrace, ffi::OsString};

use camino::Utf8Component;
use tar::Header;
Expand Down Expand Up @@ -94,7 +94,7 @@ impl CachedDirTree {

#[cfg(unix)]
{
use std::os::unix::fs::PermissionsExt;
use std::{fs, os::unix::fs::PermissionsExt};

let metadata = resolved_name.symlink_metadata()?;
let mut permissions = metadata.permissions();
Expand Down
5 changes: 4 additions & 1 deletion crates/turborepo-fs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ pub fn recursive_copy(
}
}

fn make_dir_copy(dir: impl AsRef<AbsoluteSystemPath>, src_metadata: &Metadata) -> Result<()> {
fn make_dir_copy(
dir: impl AsRef<AbsoluteSystemPath>,
#[allow(dead_code)] src_metadata: &Metadata,
) -> Result<()> {
let dir = dir.as_ref();
let mut builder = DirBuilder::new();
#[cfg(not(windows))]
Expand Down
12 changes: 6 additions & 6 deletions crates/turborepo-paths/src/anchored_system_path_buf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,18 +243,18 @@ mod tests {
}
}

#[test_case(Path::new("./foo/bar/"), "./foo/bar", ".\\foo\\bar" ; "with trailing slash")]
#[test_case(Path::new("foo/bar"), "foo/bar", "foo\\bar" ; "no trailing slash")]
#[test_case(Path::new(""), "", "" ; "empty")]
#[test_case("./foo/bar/", "./foo/bar", ".\\foo\\bar" ; "with trailing slash")]
#[test_case("foo/bar", "foo/bar", "foo\\bar" ; "no trailing slash")]
#[test_case("", "", "" ; "empty")]
fn test_from_validated_tar_path(
path: &Path,
path: &str,
expected_unix_path: &str,
#[allow(dead_code)] expected_windows_path: &str,
) {
let path = AnchoredSystemPathBuf::from_validated_tar_path(path);
#[cfg(unix)]
assert_eq!(path.to_str().unwrap(), expected_unix_path);
assert_eq!(path.as_str(), expected_unix_path);
#[cfg(windows)]
assert_eq!(path.to_str().unwrap(), expected_windows_path);
assert_eq!(path.as_str(), expected_windows_path);
}
}
2 changes: 1 addition & 1 deletion crates/turborepo-paths/src/relative_unix_path_buf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use camino::Utf8Path;

use crate::{IntoUnix, PathError, RelativeUnixPath};

#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
pub struct RelativeUnixPathBuf(pub(crate) String);

impl Display for RelativeUnixPathBuf {
Expand Down

0 comments on commit a1ebb43

Please sign in to comment.