diff --git a/Command.hs b/Command.hs index 1449d7eedf..446b1b55fe 100644 --- a/Command.hs +++ b/Command.hs @@ -132,8 +132,7 @@ withAttrFilesInGit :: String -> CommandSeekAttrFiles withAttrFilesInGit attr a params = do repo <- Annex.gitRepo files <- liftIO $ runPreserveOrder (Git.inRepo repo) params - files' <- filterFiles files - liftM (map a) $ liftIO $ Git.checkAttr repo attr files' + liftM (map a) $ liftIO $ Git.checkAttr repo attr files withBackendFilesInGit :: CommandSeekBackendFiles withBackendFilesInGit a params = do repo <- Annex.gitRepo diff --git a/GitRepo.hs b/GitRepo.hs index 34a59a10d4..4e4a063e82 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"] diff --git a/Utility.hs b/Utility.hs index e63fa1f6be..8312335f86 100644 --- a/Utility.hs +++ b/Utility.hs @@ -12,6 +12,7 @@ module Utility ( readFileStrict, parentDir, absPath, + absPathFrom, relPathCwdToDir, relPathDirToDir, boolSystem, @@ -165,8 +166,14 @@ dirContains a b = a == b || a' == b' || (a'++"/") `isPrefixOf` b' absPath :: FilePath -> IO FilePath absPath file = do cwd <- getCurrentDirectory + return $ absPathFrom cwd file + +{- Converts a filename into a normalized, absolute path + - from the specified cwd. -} +absPathFrom :: FilePath -> FilePath -> FilePath +absPathFrom cwd file = case absNormPath cwd file of - Just f -> return f + Just f -> f Nothing -> error $ "unable to normalize " ++ file {- Constructs a relative path from the CWD to a directory. diff --git a/debian/changelog b/debian/changelog index 3c5c91b1b0..3738c77589 100644 --- a/debian/changelog +++ b/debian/changelog @@ -12,6 +12,7 @@ git-annex (0.20110321) UNRELEASED; urgency=low * fsck: In fast mode, avoid checking checksums. * unused: In fast mode, just show all existing temp files as unused, and avoid expensive scan for other unused content. + * Fix space leak in fsck and drop commands. -- Joey Hess Tue, 22 Mar 2011 16:52:00 -0400