add runBool

This commit is contained in:
Joey Hess 2011-06-22 16:02:07 -04:00
parent 2e5c8ca6bf
commit ae2be332d4

View file

@ -37,6 +37,7 @@ module GitRepo (
configTrue,
gitCommandLine,
run,
runBool,
pipeRead,
pipeWrite,
pipeWriteRead,
@ -350,10 +351,15 @@ gitCommandLine repo@(Repo { location = Dir d} ) params =
] ++ params
gitCommandLine repo _ = assertLocal repo $ error "internal"
{- Runs git in the specified repo. -}
runBool :: Repo -> String -> [CommandParam] -> IO Bool
runBool repo subcommand params = assertLocal repo $
boolSystem "git" (gitCommandLine repo ((Param subcommand):params))
{- Runs git in the specified repo, throwing an error if it fails. -}
run :: Repo -> String -> [CommandParam] -> IO ()
run repo subcommand params = assertLocal repo $
boolSystem "git" (gitCommandLine repo ((Param subcommand):params))
runBool repo subcommand params
>>! error $ "git " ++ show params ++ " failed"
{- Runs a git subcommand and returns its output, lazily.