From 4797bd5e9b9b6668bf1a2c9bd25075774f26c963 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 26 Feb 2013 14:39:37 -0400 Subject: copy: Update location log when no copy was performed, if the location log was out of date. --- Command/Move.hs | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'Command') 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. -- cgit v1.2.3