summaryrefslogtreecommitdiff
path: root/Init.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-03-14 17:43:34 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-03-14 17:43:34 -0400
commit60ab3d84e188b8dd3a284d962df25bbee41ff1cb (patch)
tree768d4f632bab0152dbc1ca72f81fc3b9c7915c0a /Init.hs
parenta4f72c9625486786a4549cf4db1b542ea89da7c7 (diff)
added ifM and nuked 11 lines of code
no behavior changes
Diffstat (limited to 'Init.hs')
-rw-r--r--Init.hs17
1 files changed, 8 insertions, 9 deletions
diff --git a/Init.hs b/Init.hs
index c9d5bb909..f3d8bd017 100644
--- a/Init.hs
+++ b/Init.hs
@@ -38,23 +38,22 @@ uninitialize = gitPreCommitHookUnWrite
ensureInitialized :: Annex ()
ensureInitialized = getVersion >>= maybe needsinit checkVersion
where
- needsinit = do
- annexed <- Annex.Branch.hasSibling
- if annexed
- then initialize Nothing
- else error "First run: git-annex init"
+ needsinit = ifM Annex.Branch.hasSibling
+ ( initialize Nothing
+ , error "First run: git-annex init"
+ )
{- set up a git pre-commit hook, if one is not already present -}
gitPreCommitHookWrite :: Annex ()
gitPreCommitHookWrite = unlessBare $ do
hook <- preCommitHook
- exists <- liftIO $ doesFileExist hook
- if exists
- then warning $ "pre-commit hook (" ++ hook ++ ") already exists, not configuring"
- else liftIO $ do
+ ifM (liftIO $ doesFileExist hook)
+ ( warning $ "pre-commit hook (" ++ hook ++ ") already exists, not configuring"
+ , liftIO $ do
viaTmp writeFile hook preCommitScript
p <- getPermissions hook
setPermissions hook $ p {executable = True}
+ )
gitPreCommitHookUnWrite :: Annex ()
gitPreCommitHookUnWrite = unlessBare $ do