Fixed memory leak; git-annex no longer reads the whole file list from git before starting, and will be much faster with large repos.
This commit is contained in:
parent
963bfa9673
commit
c2651d64bc
2 changed files with 17 additions and 1 deletions
16
GitRepo.hs
16
GitRepo.hs
|
@ -27,6 +27,7 @@ module GitRepo (
|
||||||
configTrue,
|
configTrue,
|
||||||
run,
|
run,
|
||||||
pipeRead,
|
pipeRead,
|
||||||
|
hPipeRead,
|
||||||
attributes,
|
attributes,
|
||||||
remotes,
|
remotes,
|
||||||
remotesAdd,
|
remotesAdd,
|
||||||
|
@ -198,6 +199,17 @@ pipeRead repo params = assertLocal repo $ do
|
||||||
ret <- hGetContentsStrict h
|
ret <- hGetContentsStrict h
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
{- Like pipeRead, but does not read output strictly; recommended
|
||||||
|
- for git commands that produce a lot of output that will be processed
|
||||||
|
- lazily.
|
||||||
|
-
|
||||||
|
- ONLY AFTER the string has been read completely, You must call either
|
||||||
|
- getProcessStatus or forceSuccess on the PipeHandle. Zombies will result
|
||||||
|
- otherwise.-}
|
||||||
|
hPipeRead :: Repo -> [String] -> IO (PipeHandle, String)
|
||||||
|
hPipeRead repo params = assertLocal repo $ do
|
||||||
|
pipeFrom "git" (gitCommandLine repo params)
|
||||||
|
|
||||||
{- Passed a location, recursively scans for all files that
|
{- Passed a location, recursively scans for all files that
|
||||||
- are checked into git at that location. -}
|
- are checked into git at that location. -}
|
||||||
inRepo :: Repo -> FilePath -> IO [FilePath]
|
inRepo :: Repo -> FilePath -> IO [FilePath]
|
||||||
|
@ -221,7 +233,9 @@ stagedFiles repo location = pipeNullSplit repo
|
||||||
- parameter), and splits it into a list of files. -}
|
- parameter), and splits it into a list of files. -}
|
||||||
pipeNullSplit :: Repo -> [String] -> IO [FilePath]
|
pipeNullSplit :: Repo -> [String] -> IO [FilePath]
|
||||||
pipeNullSplit repo params = do
|
pipeNullSplit repo params = do
|
||||||
fs0 <- pipeRead repo params
|
-- XXX handle is left open, this is ok for git-annex, but may need
|
||||||
|
-- to be cleaned up for other uses.
|
||||||
|
(handle, fs0) <- hPipeRead repo params
|
||||||
return $ split0 fs0
|
return $ split0 fs0
|
||||||
where
|
where
|
||||||
split0 s = filter (not . null) $ split "\0" s
|
split0 s = filter (not . null) $ split "\0" s
|
||||||
|
|
2
debian/changelog
vendored
2
debian/changelog
vendored
|
@ -5,6 +5,8 @@ git-annex (0.03) UNRELEASED; urgency=low
|
||||||
* Fix SIGINT handling.
|
* Fix SIGINT handling.
|
||||||
* Fix handling of files with unusual characters in their name.
|
* Fix handling of files with unusual characters in their name.
|
||||||
* Support building with Debian stable's ghc.
|
* Support building with Debian stable's ghc.
|
||||||
|
* Fixed memory leak; git-annex no longer reads the whole file list
|
||||||
|
from git before starting, and will be much faster with large repos.
|
||||||
|
|
||||||
-- Joey Hess <joeyh@debian.org> Thu, 28 Oct 2010 13:46:59 -0400
|
-- Joey Hess <joeyh@debian.org> Thu, 28 Oct 2010 13:46:59 -0400
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue