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.)

This commit is contained in:
Joey Hess 2010-11-08 19:26:37 -04:00
parent 8dd9f8e49e
commit 1d32d902c9
8 changed files with 74 additions and 49 deletions

View file

@ -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