summaryrefslogtreecommitdiff
path: root/Command
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-02-26 14:39:37 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-02-26 14:39:37 -0400
commit4797bd5e9b9b6668bf1a2c9bd25075774f26c963 (patch)
tree923592403266315ae538de37c749d97cc512a2ec /Command
parentcbfcd75214a648bf204f8356a28e360229542bde (diff)
copy: Update location log when no copy was performed, if the location log was out of date.
Diffstat (limited to 'Command')
-rw-r--r--Command/Move.hs29
1 files changed, 16 insertions, 13 deletions
diff --git a/Command/Move.hs b/Command/Move.hs
index 20203c205..6d087ecae 100644
--- a/Command/Move.hs
+++ b/Command/Move.hs
@@ -79,9 +79,7 @@ toPerform dest move key file = moveLock move key $ do
fast <- Annex.getState Annex.fast
let fastcheck = fast && not move && not (Remote.hasKeyCheap dest)
isthere <- if fastcheck
- then do
- remotes <- Remote.keyPossibilities key
- return $ Right $ dest `elem` remotes
+ then Right <$> expectedpresent
else Remote.hasKey dest key
case isthere of
Left err -> do
@@ -92,21 +90,26 @@ toPerform dest move key file = moveLock move key $ do
ok <- upload (Remote.uuid dest) key (Just file) noRetry $
Remote.storeKey dest key (Just file)
if ok
- then finish True
+ then do
+ Remote.logStatus dest key InfoPresent
+ finish
else do
when fastcheck $
warning "This could have failed because --fast is enabled."
stop
- Right True -> finish False
+ Right True -> do
+ unlessM expectedpresent $
+ Remote.logStatus dest key InfoPresent
+ finish
where
- finish remotechanged = do
- when remotechanged $
- Remote.logStatus dest key InfoPresent
- if move
- then do
- removeAnnex key
- next $ Command.Drop.cleanupLocal key
- else next $ return True
+ finish
+ | move = do
+ removeAnnex key
+ next $ Command.Drop.cleanupLocal key
+ | otherwise = next $ return True
+ expectedpresent = do
+ remotes <- Remote.keyPossibilities key
+ return $ dest `elem` remotes
{- Moves (or copies) the content of an annexed file from a remote
- to the current repository.