diff options
author | Joey Hess <joey@kitenet.net> | 2012-03-14 17:43:34 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-03-14 17:43:34 -0400 |
commit | 60ab3d84e188b8dd3a284d962df25bbee41ff1cb (patch) | |
tree | 768d4f632bab0152dbc1ca72f81fc3b9c7915c0a /Init.hs | |
parent | a4f72c9625486786a4549cf4db1b542ea89da7c7 (diff) |
added ifM and nuked 11 lines of code
no behavior changes
Diffstat (limited to 'Init.hs')
-rw-r--r-- | Init.hs | 17 |
1 files changed, 8 insertions, 9 deletions
@@ -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 |