diff options
author | Joey Hess <joey@kitenet.net> | 2012-03-14 12:17:38 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-03-14 12:17:38 -0400 |
commit | 95a1f6b2accca9b7c6a6c30c92380dc0de57d3a0 (patch) | |
tree | d73c1e57eb5ee1fbb2f64869092716386d899db7 /Utility | |
parent | caf97fcffd0a1e934fef60c0cae878ee3813f81f (diff) |
check hook executability
Diffstat (limited to 'Utility')
-rw-r--r-- | Utility/FileMode.hs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Utility/FileMode.hs b/Utility/FileMode.hs index 6c1c06e82..571b03503 100644 --- a/Utility/FileMode.hs +++ b/Utility/FileMode.hs @@ -34,3 +34,10 @@ allowWrite f = do {- Checks if a file mode indicates it's a symlink. -} isSymLink :: FileMode -> Bool isSymLink mode = symbolicLinkMode `intersectFileModes` mode == symbolicLinkMode + +{- Checks if a file has any executable bits set. -} +isExecutable :: FileMode -> Bool +isExecutable mode = ebits `intersectFileModes` mode /= 0 + where + ebits = ownerExecuteMode `unionFileModes` + groupExecuteMode `unionFileModes` otherExecuteMode |