From b66d385a8f7b096acea95d5b6c86bc8d9520b1e3 Mon Sep 17 00:00:00 2001 From: Stephan Dilly Date: Thu, 25 Jun 2020 07:47:10 +0200 Subject: [PATCH] sort order --- asyncgit/src/sync/hooks.rs | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/asyncgit/src/sync/hooks.rs b/asyncgit/src/sync/hooks.rs index 0f7fe385..d0eb36d0 100644 --- a/asyncgit/src/sync/hooks.rs +++ b/asyncgit/src/sync/hooks.rs @@ -103,6 +103,25 @@ fn run_hook( } } +#[cfg(not(windows))] +fn is_executable(path: PathBuf) -> bool { + use std::os::unix::fs::PermissionsExt; + let metadata = match path.metadata() { + Ok(metadata) => metadata, + Err(_) => return false, + }; + + let permissions = metadata.permissions(); + permissions.mode() & 0o111 != 0 +} + +#[cfg(windows)] +/// windows does not consider bash scripts to be executable so we consider everything +/// to be executable (which is not far from the truth for windows platform.) +fn is_executable(_: PathBuf) -> bool { + true +} + #[cfg(test)] mod tests { use super::*; @@ -209,22 +228,3 @@ exit 0 assert_eq!(msg, String::from("msg\n")); } } - -#[cfg(not(windows))] -fn is_executable(path: PathBuf) -> bool { - use std::os::unix::fs::PermissionsExt; - let metadata = match path.metadata() { - Ok(metadata) => metadata, - Err(_) => return false, - }; - - let permissions = metadata.permissions(); - permissions.mode() & 0o111 != 0 -} - -#[cfg(windows)] -/// windows does not consider bash scripts to be executable so we consider everything -/// to be executable (which is not far from the truth for windows platform.) -fn is_executable(_: PathBuf) -> bool { - true -}