copy: avoid updating location log when no copy is performed

git annex copy --to remote often does not need to copy a file,
but it was still updating the location log in this case.
This commit is contained in:
Joey Hess 2012-09-24 19:58:34 -04:00
parent 72b14ec998
commit 40df26757a
2 changed files with 11 additions and 4 deletions

View file

@ -92,15 +92,16 @@ 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
then finish True
else do
when fastcheck $
warning "This could have failed because --fast is enabled."
stop
Right True -> finish
Right True -> finish False
where
finish = do
Remote.logStatus dest key InfoPresent
finish remotechanged = do
when remotechanged $
Remote.logStatus dest key InfoPresent
if move
then do
whenM (inAnnex key) $ removeAnnex key