ok/jj
1
0
Fork 0
forked from mirrors/jj

cleanup: replace #[cfg(not(windows))] by $[cfg(unix)]

I didn't realize that the `unix` configuration existed before.
This commit is contained in:
Martin von Zweigbergk 2021-03-11 17:36:55 -08:00
parent f79874d612
commit 337b15c98d
2 changed files with 6 additions and 6 deletions

View file

@ -17,9 +17,9 @@ use std::collections::{BTreeMap, HashSet};
use std::convert::TryInto; use std::convert::TryInto;
use std::fs; use std::fs;
use std::fs::{File, OpenOptions}; use std::fs::{File, OpenOptions};
#[cfg(not(windows))] #[cfg(unix)]
use std::os::unix::fs::symlink; use std::os::unix::fs::symlink;
#[cfg(not(windows))] #[cfg(unix)]
use std::os::unix::fs::PermissionsExt; use std::os::unix::fs::PermissionsExt;
#[cfg(windows)] #[cfg(windows)]
use std::os::windows::fs::symlink_file; use std::os::windows::fs::symlink_file;
@ -336,7 +336,7 @@ impl TreeState {
// when we wrote the file. // when we wrote the file.
executable = current_entry.file_type == FileType::Executable executable = current_entry.file_type == FileType::Executable
} }
#[cfg(not(windows))] #[cfg(unix)]
{ {
executable = new_file_state.file_type == FileType::Executable executable = new_file_state.file_type == FileType::Executable
} }
@ -409,7 +409,7 @@ impl TreeState {
{ {
println!("ignoring symlink at {:?}", path); println!("ignoring symlink at {:?}", path);
} }
#[cfg(not(windows))] #[cfg(unix)]
{ {
let target = self.store.read_symlink(path, id).unwrap(); let target = self.store.read_symlink(path, id).unwrap();
let target = PathBuf::from(&target); let target = PathBuf::from(&target);
@ -423,7 +423,7 @@ impl TreeState {
{ {
return; return;
} }
#[cfg(not(windows))] #[cfg(unix)]
{ {
let mode = if executable { 0o755 } else { 0o644 }; let mode = if executable { 0o755 } else { 0o644 };
fs::set_permissions(disk_path, fs::Permissions::from_mode(mode)).unwrap(); fs::set_permissions(disk_path, fs::Permissions::from_mode(mode)).unwrap();

View file

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
#[cfg(not(windows))] #[cfg(unix)]
use std::os::unix::fs::PermissionsExt; use std::os::unix::fs::PermissionsExt;
use jujube_lib::commit_builder::CommitBuilder; use jujube_lib::commit_builder::CommitBuilder;