summaryrefslogtreecommitdiff
path: root/Command/Unused.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-01-16 16:05:05 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-01-16 16:05:05 -0400
commite7b557ef5d347831142fd98eac901d79c7e1305d (patch)
treedbd5d0bcb578e457a6bb23a856b27f4aa27abd36 /Command/Unused.hs
parent84836ed804633fa3d8ff50064331b8b90bb160dd (diff)
got rid of Core module
Most of it was to do with managing annexed Content, so put there
Diffstat (limited to 'Command/Unused.hs')
-rw-r--r--Command/Unused.hs13
1 files changed, 12 insertions, 1 deletions
diff --git a/Command/Unused.hs b/Command/Unused.hs
index 62bc5d023..9fdf4cda6 100644
--- a/Command/Unused.hs
+++ b/Command/Unused.hs
@@ -9,13 +9,16 @@ module Command.Unused where
import Control.Monad.State (liftIO)
import qualified Data.Map as M
+import Data.Maybe
import Command
import Types
-import Core
+import Content
import Messages
import Locations
import qualified Annex
+import qualified GitRepo as Git
+import qualified Backend
command :: [Command]
command = [Command "unused" paramNothing seek "look for unused file content"]
@@ -80,3 +83,11 @@ unusedKeys = do
existsMap :: Ord k => [k] -> M.Map k Int
existsMap l = M.fromList $ map (\k -> (k, 1)) l
+
+{- List of keys referenced by symlinks in the git repo. -}
+getKeysReferenced :: Annex [Key]
+getKeysReferenced = do
+ g <- Annex.gitRepo
+ files <- liftIO $ Git.inRepo g [Git.workTree g]
+ keypairs <- mapM Backend.lookupFile files
+ return $ map fst $ catMaybes keypairs