summaryrefslogtreecommitdiff
path: root/Command/Unused.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2010-11-22 17:51:55 -0400
committerGravatar Joey Hess <joey@kitenet.net>2010-11-22 17:51:55 -0400
commiteeae91024285c85a7e77b1b44e501a63bced7154 (patch)
treeece6c1d1e670e04001dd570a375ed9954078da0a /Command/Unused.hs
parent57adb0347bf4eb71ab846a2947680a20263449a2 (diff)
finished hlinting
Diffstat (limited to 'Command/Unused.hs')
-rw-r--r--Command/Unused.hs8
1 files changed, 4 insertions, 4 deletions
diff --git a/Command/Unused.hs b/Command/Unused.hs
index ae189550c..de34ceae9 100644
--- a/Command/Unused.hs
+++ b/Command/Unused.hs
@@ -35,7 +35,7 @@ checkUnused :: Annex Bool
checkUnused = do
showNote "checking for unused data..."
unused <- unusedKeys
- if (null unused)
+ if null unused
then return True
else do
let list = number 1 unused
@@ -48,9 +48,10 @@ checkUnused = do
w u = unlines $
["Some annexed data is no longer pointed to by any files in the repository:",
" NUMBER KEY"]
- ++ (map (\(n, k) -> " " ++ (pad 6 $ show n) ++ " " ++ show k) u) ++
+ ++ map cols u ++
["(To see where data was previously used, try: git log --stat -S'KEY')",
"(To remove unwanted data: git-annex dropunused NUMBER)"]
+ cols (n,k) = " " ++ pad 6 (show n) ++ " " ++ show k
pad n s = s ++ replicate (n - length s) ' '
number :: Integer -> [a] -> [(Integer, a)]
@@ -71,8 +72,7 @@ unusedKeys = do
let unused_m = remove referenced present_m
return $ M.keys unused_m
where
- remove [] m = m
- remove (x:xs) m = remove xs $ M.delete x m
+ remove a b = foldl (flip M.delete) b a
existsMap :: Ord k => [k] -> M.Map k Int
existsMap l = M.fromList $ map (\k -> (k, 1)) l