summaryrefslogtreecommitdiff
path: root/Command/DropUnused.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-01-28 14:10:50 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-01-28 14:10:50 -0400
commite6da7eb1770e506661d8c6755736ed285a17554a (patch)
tree170d6a8c3a73a84f7d44de3580a774837fc8cf8f /Command/DropUnused.hs
parent04fe906ac6e611fd59ef44244a01e8fe61abec6f (diff)
Improved temp file handling
* Improved temp file handling. Transfers of content can now be resumed from temp files later; the resume does not have to be the immediate next git-annex run. * unused: Include partially transferred content in the list.
Diffstat (limited to 'Command/DropUnused.hs')
-rw-r--r--Command/DropUnused.hs7
1 files changed, 7 insertions, 0 deletions
diff --git a/Command/DropUnused.hs b/Command/DropUnused.hs
index 9427f8103..63216ce4f 100644
--- a/Command/DropUnused.hs
+++ b/Command/DropUnused.hs
@@ -7,6 +7,7 @@
module Command.DropUnused where
+import Control.Monad (when)
import Control.Monad.State (liftIO)
import qualified Data.Map as M
import System.Directory
@@ -33,8 +34,14 @@ start s = do
case M.lookup s m of
Nothing -> return Nothing
Just key -> do
+ g <- Annex.gitRepo
showStart "dropunused" s
backend <- keyBackend key
+ -- drop both content in the backend and any tmp
+ -- file for the key
+ let tmp = gitAnnexTmpLocation g key
+ tmp_exists <- liftIO $ doesFileExist tmp
+ when tmp_exists $ liftIO $ removeFile tmp
return $ Just $ Command.Drop.perform key backend (Just 0)
readUnusedLog :: Annex (M.Map String Key)