diff options
author | Joey Hess <joey@kitenet.net> | 2014-02-24 19:40:14 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2014-02-24 19:40:14 -0400 |
commit | 878e7471fa09dcc36b478e1ac1fd305d5a90b7bf (patch) | |
tree | d552b8faa43078e3dfe1f8b10063ec566eced4e2 /Git/Command.hs | |
parent | d80c547a7d1261f158148ca85e627cc2ecb005f2 (diff) | |
download | git-repair-878e7471fa09dcc36b478e1ac1fd305d5a90b7bf.tar.gz |
merge from git-annex
Diffstat (limited to 'Git/Command.hs')
-rw-r--r-- | Git/Command.hs | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/Git/Command.hs b/Git/Command.hs index 4c338ba..0fa3d1b 100644 --- a/Git/Command.hs +++ b/Git/Command.hs @@ -18,32 +18,29 @@ import qualified Utility.CoProcess as CoProcess #ifdef mingw32_HOST_OS import Git.FilePath #endif +import Utility.Batch {- Constructs a git command line operating on the specified repo. -} gitCommandLine :: [CommandParam] -> Repo -> [CommandParam] gitCommandLine params r@(Repo { location = l@(Local _ _ ) }) = setdir : settree ++ gitGlobalOpts r ++ params where - setdir = Param $ "--git-dir=" ++ gitpath (gitdir l) + setdir = Param $ "--git-dir=" ++ gitdir l settree = case worktree l of Nothing -> [] - Just t -> [Param $ "--work-tree=" ++ gitpath t] -#ifdef mingw32_HOST_OS - -- despite running on windows, msysgit wants a unix-formatted path - gitpath s - | isAbsolute s = "/" ++ dropDrive (toInternalGitPath s) - | otherwise = s -#else - gitpath = id -#endif + Just t -> [Param $ "--work-tree=" ++ t] gitCommandLine _ repo = assertLocal repo $ error "internal" {- Runs git in the specified repo. -} runBool :: [CommandParam] -> Repo -> IO Bool runBool params repo = assertLocal repo $ - boolSystemEnv "git" - (gitCommandLine params repo) - (gitEnv repo) + boolSystemEnv "git" (gitCommandLine params repo) (gitEnv repo) + +{- Runs git in batch mode. -} +runBatch :: BatchCommandMaker -> [CommandParam] -> Repo -> IO Bool +runBatch batchmaker params repo = assertLocal repo $ do + let (cmd, params') = batchmaker ("git", gitCommandLine params repo) + boolSystemEnv cmd params' (gitEnv repo) {- Runs git in the specified repo, throwing an error if it fails. -} run :: [CommandParam] -> Repo -> IO () |