diff options
author | Joey Hess <joeyh@joeyh.name> | 2015-01-20 13:39:07 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2015-01-20 14:48:16 -0400 |
commit | ce0693bea2f03ed979258baac7409f210633e397 (patch) | |
tree | 53c10d6cbb0e3b55466ca62f19dbaa0e58ec5aa5 /Annex | |
parent | 155ff5705916e5b3d4749fde901a3d40ce1c9740 (diff) |
Windows: Fix running of the pre-commit-annex hook.
Diffstat (limited to 'Annex')
-rw-r--r-- | Annex/Hook.hs | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/Annex/Hook.hs b/Annex/Hook.hs index 4848e2d61..44542c12d 100644 --- a/Annex/Hook.hs +++ b/Annex/Hook.hs @@ -16,7 +16,6 @@ import qualified Git.Hook as Git import Config import qualified Annex import Utility.Shell -import Utility.FileMode import qualified Data.Map as M @@ -53,19 +52,16 @@ hookWarning h msg = do - the existing hooks are cached. -} runAnnexHook :: Git.Hook -> Annex () runAnnexHook hook = do - cmd <- fromRepo $ Git.hookFile hook m <- Annex.getState Annex.existinghooks case M.lookup hook m of - Just True -> run cmd + Just True -> run Just False -> noop Nothing -> do - exists <- hookexists cmd + exists <- inRepo $ Git.hookExists hook Annex.changeState $ \s -> s { Annex.existinghooks = M.insert hook exists m } - when exists $ - run cmd + when exists run where - hookexists f = liftIO $ catchBoolIO $ - isExecutable . fileMode <$> getFileStatus f - run cmd = unlessM (liftIO $ boolSystem cmd []) $ - warning $ cmd ++ " failed" + run = unlessM (inRepo $ Git.runHook hook) $ do + h <- fromRepo $ Git.hookFile hook + warning $ h ++ " failed" |