diff options
author | Joey Hess <joey@kitenet.net> | 2011-03-23 23:47:02 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-03-23 23:47:02 -0400 |
commit | 03fdd0d56e554c65946b9eadd32c5be5d6d0c806 (patch) | |
tree | b712520b068bb455a51bb9bcd683801a99d753ef /Command | |
parent | 6246b807f7df32877a87d906cfbe1ae26c51dd8e (diff) |
dropunused: Significantly sped up; only read unused log file once.
Diffstat (limited to 'Command')
-rw-r--r-- | Command/DropUnused.hs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/Command/DropUnused.hs b/Command/DropUnused.hs index c6a28663e..932a8b863 100644 --- a/Command/DropUnused.hs +++ b/Command/DropUnused.hs @@ -27,12 +27,16 @@ command = [repoCommand "dropunused" (paramRepeating paramNumber) seek "drop unused file content"] seek :: [CommandSeek] -seek = [withStrings start] +seek = [withUnusedMap] -{- Drops unused content by number. -} -start :: CommandStartString -start s = notBareRepo $ do +{- Read unusedlog once, and pass the map to each start action. -} +withUnusedMap :: CommandSeek +withUnusedMap params = do m <- readUnusedLog + return $ map (start m) params + +start :: M.Map String Key -> CommandStartString +start m s = notBareRepo $ do case M.lookup s m of Nothing -> return Nothing Just key -> do |