summaryrefslogtreecommitdiff
path: root/Command/Drop.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2010-11-08 19:26:37 -0400
committerGravatar Joey Hess <joey@kitenet.net>2010-11-08 19:26:37 -0400
commit1d32d902c95a49c53c46951641852c209476cb3d (patch)
tree56b7ae1ebb6da1b3924e4abbbe608aabf95aa172 /Command/Drop.hs
parent8dd9f8e49eae081e7503facff6d5a53285194c09 (diff)
Annexed file contents are now made unwritable and put in unwriteable directories, to avoid them accidentially being removed or modified. (Thanks Josh Triplett for the idea.)
Diffstat (limited to 'Command/Drop.hs')
-rw-r--r--Command/Drop.hs17
1 files changed, 4 insertions, 13 deletions
diff --git a/Command/Drop.hs b/Command/Drop.hs
index d1ebd7f64..48433b14c 100644
--- a/Command/Drop.hs
+++ b/Command/Drop.hs
@@ -7,12 +7,9 @@
module Command.Drop where
-import Control.Monad.State (liftIO)
-import System.Directory
+import Control.Monad (when)
import Command
-import qualified Annex
-import Locations
import qualified Backend
import LocationLog
import Types
@@ -39,13 +36,7 @@ perform key backend = do
cleanup :: Key -> SubCmdCleanup
cleanup key = do
- logStatus key ValueMissing
inannex <- inAnnex key
- if (inannex)
- then do
- g <- Annex.gitRepo
- let loc = annexLocation g key
- liftIO $ removeFile loc
- return True
- else return True
-
+ when (inannex) $ removeAnnex key
+ logStatus key ValueMissing
+ return True