From 14ce1badd4210ebb2660e0fb22ba4ff7f2986dee Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 13 Jan 2014 18:10:21 -0400 Subject: merge from git-annex --- Git/Command.hs | 7 ++++++- Git/LsFiles.hs | 5 +++-- Git/Objects.hs | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) (limited to 'Git') 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 -- cgit v1.2.3