summaryrefslogtreecommitdiff
path: root/Git
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2014-01-13 18:10:21 -0400
committerJoey Hess <joey@kitenet.net>2014-01-13 18:10:21 -0400
commit14ce1badd4210ebb2660e0fb22ba4ff7f2986dee (patch)
treea0eb1548d7d879631cef51266e8f2ee65fa7a66f /Git
parentdd1d8e69d4c190c7bb60d5187f7a889c6fea0d62 (diff)
downloadgit-repair-14ce1badd4210ebb2660e0fb22ba4ff7f2986dee.tar.gz
merge from git-annex
Diffstat (limited to 'Git')
-rw-r--r--Git/Command.hs7
-rw-r--r--Git/LsFiles.hs5
-rw-r--r--Git/Objects.hs2
3 files changed, 10 insertions, 4 deletions
diff --git a/Git/Command.hs b/Git/Command.hs
index adcc53b..4c338ba 100644
--- a/Git/Command.hs
+++ b/Git/Command.hs
@@ -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 =
diff --git a/Git/LsFiles.hs b/Git/LsFiles.hs
index 8aaa090..e155845 100644
--- a/Git/LsFiles.hs
+++ b/Git/LsFiles.hs
@@ -66,11 +66,12 @@ modified l repo = pipeNullSplit params repo
where
params = [Params "ls-files --modified -z --"] ++ map File l
-{- Files that have been modified or are not checked into git. -}
+{- Files that have been modified or are not checked into git (and are not
+ - ignored). -}
modifiedOthers :: [FilePath] -> Repo -> IO ([FilePath], IO Bool)
modifiedOthers l repo = pipeNullSplit params repo
where
- params = [Params "ls-files --modified --others -z --"] ++ map File l
+ params = [Params "ls-files --modified --others --exclude-standard -z --"] ++ map File l
{- Returns a list of all files that are staged for commit. -}
staged :: [FilePath] -> Repo -> IO ([FilePath], IO Bool)
diff --git a/Git/Objects.hs b/Git/Objects.hs
index d9d2c67..bb492f5 100644
--- a/Git/Objects.hs
+++ b/Git/Objects.hs
@@ -27,7 +27,7 @@ listPackFiles r = filter (".pack" `isSuffixOf`)
listLooseObjectShas :: Repo -> IO [Sha]
listLooseObjectShas r = catchDefaultIO [] $
mapMaybe (extractSha . concat . reverse . take 2 . reverse . splitDirectories)
- <$> dirContentsRecursiveSkipping (== "pack") (objectsDir r)
+ <$> dirContentsRecursiveSkipping (== "pack") True (objectsDir r)
looseObjectFile :: Repo -> Sha -> FilePath
looseObjectFile r sha = objectsDir r </> prefix </> rest