diff --git a/lib/src/working_copy.rs b/lib/src/working_copy.rs index 5d82c94b0..e896fc8c2 100644 --- a/lib/src/working_copy.rs +++ b/lib/src/working_copy.rs @@ -17,9 +17,9 @@ use std::collections::{BTreeMap, HashSet}; use std::convert::TryInto; use std::fs; use std::fs::{File, OpenOptions}; -#[cfg(not(windows))] +#[cfg(unix)] use std::os::unix::fs::symlink; -#[cfg(not(windows))] +#[cfg(unix)] use std::os::unix::fs::PermissionsExt; #[cfg(windows)] use std::os::windows::fs::symlink_file; @@ -336,7 +336,7 @@ impl TreeState { // when we wrote the file. executable = current_entry.file_type == FileType::Executable } - #[cfg(not(windows))] + #[cfg(unix)] { executable = new_file_state.file_type == FileType::Executable } @@ -409,7 +409,7 @@ impl TreeState { { println!("ignoring symlink at {:?}", path); } - #[cfg(not(windows))] + #[cfg(unix)] { let target = self.store.read_symlink(path, id).unwrap(); let target = PathBuf::from(&target); @@ -423,7 +423,7 @@ impl TreeState { { return; } - #[cfg(not(windows))] + #[cfg(unix)] { let mode = if executable { 0o755 } else { 0o644 }; fs::set_permissions(disk_path, fs::Permissions::from_mode(mode)).unwrap(); diff --git a/lib/tests/test_working_copy.rs b/lib/tests/test_working_copy.rs index 64658aa1c..bf5f154d3 100644 --- a/lib/tests/test_working_copy.rs +++ b/lib/tests/test_working_copy.rs @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#[cfg(not(windows))] +#[cfg(unix)] use std::os::unix::fs::PermissionsExt; use jujube_lib::commit_builder::CommitBuilder;