Avoid looping if long-running git cat-file or git hash-object crashes and keeps crashing when restarted.

This commit is contained in:
Joey Hess 2014-01-01 21:42:25 -04:00
parent e3344c1c71
commit 858eb26303
4 changed files with 17 additions and 7 deletions

View file

@ -128,9 +128,14 @@ leaveZombie = fst
{- Runs a git command as a coprocess. -}
gitCoProcessStart :: Bool -> [CommandParam] -> Repo -> IO CoProcess.CoProcessHandle
gitCoProcessStart restartable params repo = CoProcess.start restartable "git"
gitCoProcessStart restartable params repo = CoProcess.start numrestarts "git"
(toCommand $ gitCommandLine params repo)
(gitEnv repo)
where
{- If a long-running git command like cat-file --batch
- crashes, it will likely start up again ok. If it keeps crashing
- 10 times, something is badly wrong. -}
numrestarts = if restartable then 10 else 0
gitCreateProcess :: [CommandParam] -> Repo -> CreateProcess
gitCreateProcess params repo =