summaryrefslogtreecommitdiff
path: root/Command/DropUnused.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Command/DropUnused.hs')
-rw-r--r--Command/DropUnused.hs10
1 files changed, 8 insertions, 2 deletions
diff --git a/Command/DropUnused.hs b/Command/DropUnused.hs
index ea2ff46eb..cfd6fc3d0 100644
--- a/Command/DropUnused.hs
+++ b/Command/DropUnused.hs
@@ -9,6 +9,7 @@ module Command.DropUnused where
import Control.Monad.State (liftIO)
import qualified Data.Map as M
+import System.Directory
import Command
import Types
@@ -39,8 +40,13 @@ start s = do
readUnusedLog :: Annex (M.Map String Key)
readUnusedLog = do
g <- Annex.gitRepo
- l <- liftIO $ readFile (annexUnusedLog g)
- return $ M.fromList $ map parse $ lines l
+ let f = annexUnusedLog g
+ e <- liftIO $ doesFileExist f
+ if e
+ then do
+ l <- liftIO $ readFile f
+ return $ M.fromList $ map parse $ lines l
+ else return $ M.empty
where
parse line = (head ws, tokey $ unwords $ tail ws)
where