aboutsummaryrefslogtreecommitdiff
path: root/Command/Unannex.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/Unannex.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/Unannex.hs')
-rw-r--r--Command/Unannex.hs9
1 files changed, 5 insertions, 4 deletions
diff --git a/Command/Unannex.hs b/Command/Unannex.hs
index e0848cd4a..a9c18f765 100644
--- a/Command/Unannex.hs
+++ b/Command/Unannex.hs
@@ -13,7 +13,6 @@ import System.Directory
import Command
import qualified Annex
import Utility
-import Locations
import qualified Backend
import LocationLog
import Types
@@ -38,12 +37,14 @@ perform file key backend = do
cleanup :: FilePath -> Key -> SubCmdCleanup
cleanup file key = do
- logStatus key ValueMissing
g <- Annex.gitRepo
- let src = annexLocation g key
+
liftIO $ removeFile file
liftIO $ Git.run g ["rm", "--quiet", file]
-- git rm deletes empty directories; put them back
liftIO $ createDirectoryIfMissing True (parentDir file)
- liftIO $ renameFile src file
+
+ fromAnnex key file
+ logStatus key ValueMissing
+
return True