summaryrefslogtreecommitdiff
path: root/Command
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-09-20 20:14:17 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-09-20 20:14:17 -0400
commit98fbeba0df112753e0c55b0e2f456cd89ed0ede7 (patch)
tree9f8bf7de22dbd923d21fadc78978714603917aac /Command
parent9f5c7a246b786e350671551cafae0f9678d83648 (diff)
bugfix
Different keys can have the same size, so can't make a Set of the sizes. This version actually runs faster yet, too..
Diffstat (limited to 'Command')
-rw-r--r--Command/Status.hs11
1 files changed, 5 insertions, 6 deletions
diff --git a/Command/Status.hs b/Command/Status.hs
index d06865b6a..26122f269 100644
--- a/Command/Status.hs
+++ b/Command/Status.hs
@@ -147,14 +147,13 @@ cachedKeysReferenced = do
keySizeSum :: Set Key -> StatState String
keySizeSum s = do
- let (sizes, unknownsizes) = S.partition isJust $ S.map keySize s
- let total = roughSize storageUnits False $
- fromJust $ S.fold (liftM2 (+)) (Just 0) sizes
- let num = S.size unknownsizes
+ let knownsizes = mapMaybe keySize $ S.toList s
+ let total = roughSize storageUnits False $ sum knownsizes
+ let missing = S.size s - genericLength knownsizes
return $ total ++
- if num == 0
+ if missing == 0
then ""
- else aside $ "but " ++ show num ++ " keys have unknown size"
+ else aside $ "but " ++ show missing ++ " keys have unknown size"
staleSize :: String -> (Git.Repo -> FilePath) -> Stat
staleSize label dirspec = do