summaryrefslogtreecommitdiff
path: root/Git
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-09-05 12:09:23 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-09-05 12:09:23 -0400
commitd0d0d07b9e88992f8beedce33a78918e27b41a6a (patch)
treee6d8404473a702a662a0d32299cc992e4fafeeb7 /Git
parent362a9d87c473e0bc9b50757cd58567f3cd37d40c (diff)
Windows: Handle shebang in external special remote program.
Diffstat (limited to 'Git')
-rw-r--r--Git/Hook.hs21
1 files changed, 2 insertions, 19 deletions
diff --git a/Git/Hook.hs b/Git/Hook.hs
index f4424c60e..da999733d 100644
--- a/Git/Hook.hs
+++ b/Git/Hook.hs
@@ -12,6 +12,7 @@ module Git.Hook where
import Common
import Git
import Utility.Tmp
+import Utility.Shell
#ifndef mingw32_HOST_OS
import Utility.FileMode
#endif
@@ -75,23 +76,5 @@ hookExists h r = do
runHook :: Hook -> Repo -> IO Bool
runHook h r = do
let f = hookFile h r
- (c, ps) <- findcmd f
+ (c, ps) <- findShellCommand f
boolSystem c ps
- where
-#ifndef mingw32_HOST_OS
- findcmd = defcmd
-#else
- {- Like git for windows, parse the first line of the hook file,
- - look for "#!", and dispatch the interpreter on the file. -}
- findcmd f = do
- l <- headMaybe . lines <$> catchDefaultIO "" (readFile f)
- case l of
- Just ('#':'!':rest) -> case words rest of
- [] -> defcmd f
- (c:ps) -> do
- let ps' = map Param (ps ++ [f])
- ok <- inPath c
- return (if ok then c else takeFileName c, ps')
- _ -> defcmd f
-#endif
- defcmd f = return (f, [])