Slow and ugly work around for bug #718517 in git, which broke git-cat-file --batch for filenames containing spaces.
This runs git-cat-file in non-batch mode for all files with spaces. If a directory tree has a lot of them, and is in direct mode, even "git annex add" when there are few new files will need a *lot* of forks! The only reason buffering the whole file content to get the sha is not a memory leak is that git-annex only ever uses this on symlinks. This needs to be reverted as soon as a fix is available in git!
This commit is contained in:
parent
4e6f498cb8
commit
d16114d024
3 changed files with 48 additions and 11 deletions
|
@ -25,6 +25,7 @@ module Utility.Process (
|
|||
withHandle,
|
||||
withBothHandles,
|
||||
withQuietOutput,
|
||||
withNullHandle,
|
||||
createProcess,
|
||||
startInteractiveProcess,
|
||||
stdinHandle,
|
||||
|
@ -241,12 +242,15 @@ withQuietOutput
|
|||
:: CreateProcessRunner
|
||||
-> CreateProcess
|
||||
-> IO ()
|
||||
withQuietOutput creator p = withFile devnull WriteMode $ \nullh -> do
|
||||
withQuietOutput creator p = withNullHandle $ \nullh -> do
|
||||
let p' = p
|
||||
{ std_out = UseHandle nullh
|
||||
, std_err = UseHandle nullh
|
||||
}
|
||||
creator p' $ const $ return ()
|
||||
|
||||
withNullHandle :: (Handle -> IO a) -> IO a
|
||||
withNullHandle = withFile devnull WriteMode
|
||||
where
|
||||
#ifndef mingw32_HOST_OS
|
||||
devnull = "/dev/null"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue