summaryrefslogtreecommitdiff
path: root/Init.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-03-16 01:59:07 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-03-16 01:59:07 -0400
commit184a69171d5d983ee2f08cce28011d235f44cc5c (patch)
treeff85fc620618b55c8cbed0d8c99212e73004f5b5 /Init.hs
parentc0c9991c9f5322aef05f4c97d2c3f3bdc3101e46 (diff)
removed another 10 lines via ifM
Diffstat (limited to 'Init.hs')
-rw-r--r--Init.hs10
1 files changed, 5 insertions, 5 deletions
diff --git a/Init.hs b/Init.hs
index f3d8bd017..9f1988a39 100644
--- a/Init.hs
+++ b/Init.hs
@@ -58,13 +58,13 @@ gitPreCommitHookWrite = unlessBare $ do
gitPreCommitHookUnWrite :: Annex ()
gitPreCommitHookUnWrite = unlessBare $ do
hook <- preCommitHook
- whenM (liftIO $ doesFileExist hook) $ do
- c <- liftIO $ readFile hook
- if c == preCommitScript
- then liftIO $ removeFile hook
- else warning $ "pre-commit hook (" ++ hook ++
+ whenM (liftIO $ doesFileExist hook) $
+ ifM (liftIO $ (==) preCommitScript <$> readFile hook)
+ ( liftIO $ removeFile hook
+ , warning $ "pre-commit hook (" ++ hook ++
") contents modified; not deleting." ++
" Edit it to remove call to git annex."
+ )
unlessBare :: Annex () -> Annex ()
unlessBare = unlessM $ fromRepo Git.repoIsLocalBare