diff options
Diffstat (limited to 'vendor/gix-fs/src/lib.rs')
-rw-r--r-- | vendor/gix-fs/src/lib.rs | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/vendor/gix-fs/src/lib.rs b/vendor/gix-fs/src/lib.rs index aa576c240..1a3168928 100644 --- a/vendor/gix-fs/src/lib.rs +++ b/vendor/gix-fs/src/lib.rs @@ -2,6 +2,8 @@ #![deny(rust_2018_idioms, missing_docs)] #![forbid(unsafe_code)] +use std::path::PathBuf; + /// Common knowledge about the worktree that is needed across most interactions with the work tree #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone, Copy)] @@ -25,9 +27,6 @@ pub struct Capabilities { mod capabilities; mod snapshot; - -use std::path::PathBuf; - pub use snapshot::{FileSnapshot, SharedFileSnapshot, SharedFileSnapshotMut}; /// @@ -51,5 +50,18 @@ pub struct Stack { current_is_directory: bool, } +#[cfg(unix)] +/// Returns whether a a file has the executable permission set. +pub fn is_executable(metadata: &std::fs::Metadata) -> bool { + use std::os::unix::fs::MetadataExt; + (metadata.mode() & 0o100) != 0 +} + +#[cfg(not(unix))] +/// Returns whether a a file has the executable permission set. +pub fn is_executable(_metadata: &std::fs::Metadata) -> bool { + false +} + /// pub mod stack; |