copy: Update location log when no copy was performed, if the location log was out of date.

This commit is contained in:
Joey Hess 2013-02-26 14:39:37 -04:00
parent 7df2861d67
commit 3b92c279e8
2 changed files with 18 additions and 13 deletions

View file

@ -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.

2
debian/changelog vendored
View file

@ -19,6 +19,8 @@ git-annex (3.20130217) UNRELEASED; urgency=low
* Fix a reversion in matching globs introduced in the last release,
where "*" did not match files inside subdirectories. No longer uses
the Glob library.
* copy: Update location log when no copy was performed, if the location
log was out of date.
-- Joey Hess <joeyh@debian.org> Sun, 17 Feb 2013 16:42:16 -0400