forked from mirrors/jj
working_copy: avoid std::os::unix on Windows
std::os::unix::fs::PermissionsExt::mode() does not exist on Windows. Treat files on Windows as regular files.
This commit is contained in:
parent
5631e85502
commit
4cd29a2130
2 changed files with 5 additions and 0 deletions
|
@ -254,7 +254,10 @@ impl TreeState {
|
||||||
} else if metadata_file_type.is_symlink() {
|
} else if metadata_file_type.is_symlink() {
|
||||||
FileType::Symlink
|
FileType::Symlink
|
||||||
} else {
|
} else {
|
||||||
|
#[cfg(unix)]
|
||||||
let mode = metadata.permissions().mode();
|
let mode = metadata.permissions().mode();
|
||||||
|
#[cfg(windows)]
|
||||||
|
let mode = 0;
|
||||||
if mode & 0o111 != 0 {
|
if mode & 0o111 != 0 {
|
||||||
FileType::Executable
|
FileType::Executable
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -195,6 +195,7 @@ fn test_checkout_file_transitions(use_git: bool) {
|
||||||
assert_eq!(maybe_metadata.is_ok(), true, "{:?} should exist", path);
|
assert_eq!(maybe_metadata.is_ok(), true, "{:?} should exist", path);
|
||||||
let metadata = maybe_metadata.unwrap();
|
let metadata = maybe_metadata.unwrap();
|
||||||
assert_eq!(metadata.is_file(), true, "{:?} should be a file", path);
|
assert_eq!(metadata.is_file(), true, "{:?} should be a file", path);
|
||||||
|
#[cfg(unix)]
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
metadata.permissions().mode() & 0o111,
|
metadata.permissions().mode() & 0o111,
|
||||||
0,
|
0,
|
||||||
|
@ -206,6 +207,7 @@ fn test_checkout_file_transitions(use_git: bool) {
|
||||||
assert_eq!(maybe_metadata.is_ok(), true, "{:?} should exist", path);
|
assert_eq!(maybe_metadata.is_ok(), true, "{:?} should exist", path);
|
||||||
let metadata = maybe_metadata.unwrap();
|
let metadata = maybe_metadata.unwrap();
|
||||||
assert_eq!(metadata.is_file(), true, "{:?} should be a file", path);
|
assert_eq!(metadata.is_file(), true, "{:?} should be a file", path);
|
||||||
|
#[cfg(unix)]
|
||||||
assert_ne!(
|
assert_ne!(
|
||||||
metadata.permissions().mode() & 0o111,
|
metadata.permissions().mode() & 0o111,
|
||||||
0,
|
0,
|
||||||
|
|
Loading…
Reference in a new issue