summaryrefslogtreecommitdiff
path: root/Command/Move.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-10-09 16:16:03 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-10-09 16:16:03 -0400
commit59e14fb081908f3d40eac6890cb668c088b86d92 (patch)
tree750482021e4aff738e1b27e37b8101043a41c3f0 /Command/Move.hs
parente3eb0165dfec73d065b409d14ac83f855384b56b (diff)
also generate a drop safety proof for move --from remote
Diffstat (limited to 'Command/Move.hs')
-rw-r--r--Command/Move.hs19
1 files changed, 17 insertions, 2 deletions
diff --git a/Command/Move.hs b/Command/Move.hs
index bd1b6dd92..9a289d8b6 100644
--- a/Command/Move.hs
+++ b/Command/Move.hs
@@ -1,6 +1,6 @@
{- git-annex command
-
- - Copyright 2010-2013 Joey Hess <id@joeyh.name>
+ - Copyright 2010-2015 Joey Hess <id@joeyh.name>
-
- Licensed under the GNU GPL version 3 or higher.
-}
@@ -16,6 +16,9 @@ import qualified Remote
import Annex.UUID
import Annex.Transfer
import Logs.Presence
+import Annex.NumCopies
+
+import System.Log.Logger (debugM)
cmd :: Command
cmd = withGlobalOptions (jobsOption : annexedMatchingOptions) $
@@ -170,6 +173,18 @@ fromPerform src move key afile = ifM (inAnnex key)
Remote.retrieveKeyFile src key afile t p
dispatch _ False = stop -- failed
dispatch False True = next $ return True -- copy complete
- dispatch True True = do -- finish moving
+ -- Finish by dropping from remote, taking care to verify that
+ -- the copy here has not been lost somehow.
+ -- (NumCopies is 1 since we're moving.)
+ dispatch True True = verifyEnoughCopiesToDrop "" key Nothing
+ (NumCopies 1) [] [] [UnVerifiedHere] dropremote faileddropremote
+ dropremote proof = do
+ liftIO $ debugM "drop" $ unwords
+ [ "Dropping from remote"
+ , show src
+ , "proof:"
+ , show proof
+ ]
ok <- Remote.removeKey src key
next $ Command.Drop.cleanupRemote key src ok
+ faileddropremote = error "Unable to drop from remote."