avoid writing pre-commit hook if we cannot make it executable

This commit is contained in:
Joey Hess 2013-02-18 15:52:50 -04:00
parent bff6c9f53f
commit 2b86dc0271

View file

@ -76,10 +76,11 @@ gitPreCommitHookWrite = unlessBare $ do
hook <- preCommitHook
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}
, unlessM crippledFileSystem $
liftIO $ do
viaTmp writeFile hook preCommitScript
p <- getPermissions hook
setPermissions hook $ p {executable = True}
)
gitPreCommitHookUnWrite :: Annex ()