diff options
author | Joey Hess <joey@kitenet.net> | 2011-06-20 21:35:39 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-06-20 21:37:18 -0400 |
commit | d519bc71372fe1962a9e03fc5472f9fe870066f8 (patch) | |
tree | 4ba88700087a88f1c335b33942b88f95e3ce7a53 /GitRepo.hs | |
parent | c835166a7cebfa44d232bbed7c5b5e22bdfeb2bd (diff) |
sped up git-union-merge
Avoided the slow git add, instead inject content directly into git and
populate the index all in one pass. Now this runs on my large real-world
repo in 10 seconds, which is acceptable.
Also lots of code cleanups.
Diffstat (limited to 'GitRepo.hs')
-rw-r--r-- | GitRepo.hs | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/GitRepo.hs b/GitRepo.hs index 0bee2842a..9f4a38a5f 100644 --- a/GitRepo.hs +++ b/GitRepo.hs @@ -38,6 +38,8 @@ module GitRepo ( gitCommandLine, run, pipeRead, + pipeWrite, + pipeWriteRead, pipeNullSplit, attributes, remotes, @@ -348,7 +350,7 @@ run repo subcommand params = assertLocal repo $ boolSystem "git" (gitCommandLine repo ((Param subcommand):params)) >>! error $ "git " ++ show params ++ " failed" -{- Runs a git subcommand and returns it output, lazily. +{- Runs a git subcommand and returns its output, lazily. - - Note that this leaves the git process running, and so zombies will - result unless reap is called. @@ -358,6 +360,18 @@ pipeRead repo params = assertLocal repo $ do (_, s) <- pipeFrom "git" $ toCommand $ gitCommandLine repo params return s +{- Runs a git subcommand, feeding it input. + - You should call either getProcessStatus or forceSuccess on the PipeHandle. -} +pipeWrite :: Repo -> [CommandParam] -> String -> IO PipeHandle +pipeWrite repo params s = assertLocal repo $ + pipeTo "git" (toCommand $ gitCommandLine repo params) s + +{- Runs a git subcommand, feeding it input, and returning its output. + - You should call either getProcessStatus or forceSuccess on the PipeHandle. -} +pipeWriteRead :: Repo -> [CommandParam] -> String -> IO (PipeHandle, String) +pipeWriteRead repo params s = assertLocal repo $ + pipeBoth "git" (toCommand $ gitCommandLine repo params) s + {- Reaps any zombie git processes. -} reap :: IO () reap = do |