From ae2be332d463bb2942c5951ffa4acf4d32d63ce2 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 22 Jun 2011 16:02:07 -0400 Subject: add runBool --- GitRepo.hs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/GitRepo.hs b/GitRepo.hs index 91ddf6dca..d1f122fba 100644 --- a/GitRepo.hs +++ b/GitRepo.hs @@ -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. -- cgit v1.2.3