summaryrefslogtreecommitdiff
path: root/Utility/FileMode.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-04-21 16:59:49 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-04-21 19:36:03 -0400
commitb98b69e8c6d9b873a864b79cff857882f67ee576 (patch)
tree4ae145f9fe34c5e71424ab3d12dca6ab8070ce41 /Utility/FileMode.hs
parent7e45712d194aa2b231083c3ccee3668f053e5717 (diff)
honor core.sharedRepository when making all the other files in the annex
Lock files, directories, etc.
Diffstat (limited to 'Utility/FileMode.hs')
-rw-r--r--Utility/FileMode.hs11
1 files changed, 11 insertions, 0 deletions
diff --git a/Utility/FileMode.hs b/Utility/FileMode.hs
index f3db70923..c0f2ad589 100644
--- a/Utility/FileMode.hs
+++ b/Utility/FileMode.hs
@@ -75,6 +75,17 @@ isExecutable mode = combineModes ebits `intersectFileModes` mode /= 0
where
ebits = [ownerExecuteMode, groupExecuteMode, otherExecuteMode]
+{- Runs an action without that pesky umask influencing it, unless the
+ - passed FileMode is the standard one. -}
+noUmask :: FileMode -> IO a -> IO a
+noUmask mode a
+ | mode == stdFileMode = a
+ | otherwise = bracket setup cleanup go
+ where
+ setup = setFileCreationMask nullFileMode
+ cleanup = setFileCreationMask
+ go _ = a
+
combineModes :: [FileMode] -> FileMode
combineModes [] = undefined
combineModes [m] = m