summaryrefslogtreecommitdiff
path: root/Command
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-03-27 18:34:30 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-03-27 18:34:30 -0400
commit4868b64868747455a9c5d512650f9e7074e6009e (patch)
tree3b4cf46d14b1c04a34a106ca55cca7b0cc00bd87 /Command
parent9a4127f0fed9fa9cd684fff78b3a2af9da3c62ad (diff)
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.
Diffstat (limited to 'Command')
-rw-r--r--Command/Move.hs10
1 files changed, 8 insertions, 2 deletions
diff --git a/Command/Move.hs b/Command/Move.hs
index 907bbf00e..3ac5a7ab2 100644
--- a/Command/Move.hs
+++ b/Command/Move.hs
@@ -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