Provide a less expensive version of git annex copy --to, enabled via --fast. This assumes that location tracking information is correct, rather than contacting the remote for every file.

This commit is contained in:
Joey Hess 2011-03-27 18:34:30 -04:00
parent 9a4127f0fe
commit 4868b64868
4 changed files with 42 additions and 9 deletions

View file

@ -84,8 +84,14 @@ toStart dest move file = isAnnexed file $ \(key, _) -> do
return $ Just $ toPerform dest move key
toPerform :: Remote.Remote Annex -> Bool -> Key -> CommandPerform
toPerform dest move key = do
-- checking the remote is expensive, so not done in the start step
isthere <- Remote.hasKey dest key
-- Checking the remote is expensive, so not done in the start step.
-- In fast mode, location tracking is assumed to be correct,
-- and an explicit check is not done, when copying. When moving,
-- it has to be done, to avoid inaverdent data loss.
fast <- Annex.getState Annex.fast
isthere <- if fast && not move
then return $ Right True
else Remote.hasKey dest key
case isthere of
Left err -> do
showNote $ show err