summaryrefslogtreecommitdiff
path: root/Command/Unused.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-05-02 14:59:05 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-05-02 14:59:05 -0400
commit392931eca9191117ae5c9d479fabab1e8ecaf8df (patch)
treedcddce458b701d795c8b3ef7385ad955301c9ac0 /Command/Unused.hs
parent7d6b36dffbb11837a6fcfea3317b7d24ccbeeff7 (diff)
addunused: New command, the opposite of dropunused, it relinks unused content into the git repository.
Diffstat (limited to 'Command/Unused.hs')
-rw-r--r--Command/Unused.hs10
1 files changed, 2 insertions, 8 deletions
diff --git a/Command/Unused.hs b/Command/Unused.hs
index 5bdadcf44..6b319ee72 100644
--- a/Command/Unused.hs
+++ b/Command/Unused.hs
@@ -19,9 +19,9 @@ import Control.Monad.ST
import Common.Annex
import Command
+import Logs.Unused
import Annex.Content
import Utility.FileMode
-import Utility.TempFile
import Logs.Location
import Config
import qualified Annex
@@ -91,19 +91,13 @@ check file msg a c = do
l <- a
let unusedlist = number c l
unless (null l) $ showLongNote $ msg unusedlist
- writeUnusedFile file unusedlist
+ writeUnusedLog file unusedlist
return $ c + length l
number :: Int -> [a] -> [(Int, a)]
number _ [] = []
number n (x:xs) = (n+1, x) : number (n+1) xs
-writeUnusedFile :: FilePath -> [(Int, Key)] -> Annex ()
-writeUnusedFile prefix l = do
- logfile <- fromRepo $ gitAnnexUnusedLog prefix
- liftIO $ viaTmp writeFile logfile $
- unlines $ map (\(n, k) -> show n ++ " " ++ show k) l
-
table :: [(Int, Key)] -> [String]
table l = " NUMBER KEY" : map cols l
where