summaryrefslogtreecommitdiff
path: root/GitRepo.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-03-22 20:31:22 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-03-22 20:31:22 -0400
commitc1dc4079419cff94cca72441d5e67a866110ec7e (patch)
treede0fee3eacb276f3e008c86320b8ffe1345f5892 /GitRepo.hs
parent5d759195618a96ce745b8ee559b439c86426a0f3 (diff)
Fix space leak in fsck and drop commands.
The space leak was somehow caused by this line: absfiles <- mapM absPath files I confess, I don't quite understand why this caused bad buffering, but apparently the whole pipeline from git-ls-files backed up at that point. Happily, rewriting the code to only get the cwd once and use a pure function to calculate absfiles clears it up, and should be a little more efficient in syscalls too.
Diffstat (limited to 'GitRepo.hs')
-rw-r--r--GitRepo.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/GitRepo.hs b/GitRepo.hs
index 34a59a10d..4e4a063e8 100644
--- a/GitRepo.hs
+++ b/GitRepo.hs
@@ -449,9 +449,9 @@ checkAttr repo attr files = do
-- top of the repo). But we're passed files relative to the current
-- directory. Convert to absolute, and then convert the filenames
-- in its output back to relative.
- absfiles <- mapM absPath files
- (_, s) <- pipeBoth "git" (toCommand params) $ join "\0" absfiles
cwd <- getCurrentDirectory
+ let absfiles = map (absPathFrom cwd) files
+ (_, s) <- pipeBoth "git" (toCommand params) $ join "\0" absfiles
return $ map (topair $ cwd++"/") $ lines s
where
params = gitCommandLine repo [Param "check-attr", Param attr, Params "-z --stdin"]