avoid using cat-file --buffer if git is too old

This is only needed for the i386ancient build, so build in the git
version git-annex is built with, assuming git won't be upgraded, or if
it is, they just won't get the speedup of --buffer
This commit is contained in:
Joey Hess 2020-07-15 10:56:32 -04:00
parent 360dc386e7
commit 8cd0e351ba
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

@ -51,6 +51,7 @@ import Git.FilePath
import Git.HashObject import Git.HashObject
import qualified Git.LsTree as LsTree import qualified Git.LsTree as LsTree
import qualified Utility.CoProcess as CoProcess import qualified Utility.CoProcess as CoProcess
import qualified Git.BuildVersion as BuildVersion
import Utility.Tuple import Utility.Tuple
data CatFileHandle = CatFileHandle data CatFileHandle = CatFileHandle
@ -381,10 +382,14 @@ withCatFileStream
withCatFileStream check repo reader = assertLocal repo $ withCatFileStream check repo reader = assertLocal repo $
bracketIO start stop $ \(c, hin, hout, _) -> reader c hin hout bracketIO start stop $ \(c, hin, hout, _) -> reader c hin hout
where where
params = params = catMaybes
[ Param "cat-file" [ Just $ Param "cat-file"
, Param ("--batch" ++ (if check then "-check" else "") ++ "=" ++ batchFormat) , Just $ Param ("--batch" ++ (if check then "-check" else "") ++ "=" ++ batchFormat)
, Param "--buffer" -- This option makes it faster, but is not present in
-- older versions of git.
, if BuildVersion.older "2.4.3"
then Nothing
else Just $ Param "--buffer"
] ]
start = do start = do