summaryrefslogtreecommitdiff
path: root/Command/Move.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-06-05 13:51:22 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-06-05 13:51:22 -0400
commitdb0d798180cb076b9b549bc07344cab70cda5ec0 (patch)
treebdc19aa10614c236d21baee175211e374ea6d8fa /Command/Move.hs
parent8b57339c61e493128c927dfbde406d6724fbc818 (diff)
move --to: Better behavior when system is completely out of disk space; drop content from disk before writing location log.
I noticed move --to failing when there was no disk space. The file was sent to the remote, but it crashed before it could be dropped locally. This could fix that.
Diffstat (limited to 'Command/Move.hs')
-rw-r--r--Command/Move.hs20
1 files changed, 13 insertions, 7 deletions
diff --git a/Command/Move.hs b/Command/Move.hs
index 710d09d06..2d2a6a227 100644
--- a/Command/Move.hs
+++ b/Command/Move.hs
@@ -113,23 +113,29 @@ toPerform dest move key afile fastcheck isthere =
upload (Remote.uuid dest) key afile noRetry noObserver $
Remote.storeKey dest key afile
if ok
- then do
+ then finish $
Remote.logStatus dest key InfoPresent
- finish
else do
when fastcheck $
warning "This could have failed because --fast is enabled."
stop
- Right True -> do
+ Right True -> finish $
unlessM (expectedPresent dest key) $
Remote.logStatus dest key InfoPresent
- finish
where
- finish
+ finish :: Annex () -> CommandPerform
+ finish setpresentremote
| move = lockContentForRemoval key $ \contentlock -> do
+ -- Drop content before updating location logs,
+ -- in case disk space is very low this frees up
+ -- space before writing data to disk.
removeAnnex contentlock
- next $ Command.Drop.cleanupLocal key
- | otherwise = next $ return True
+ next $ do
+ setpresentremote
+ Command.Drop.cleanupLocal key
+ | otherwise = next $ do
+ setpresentremote
+ return True
{- Moves (or copies) the content of an annexed file from a remote
- to the current repository.