diff options
author | Joey Hess <joey@kitenet.net> | 2011-03-27 18:34:30 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-03-27 18:34:30 -0400 |
commit | 4868b64868747455a9c5d512650f9e7074e6009e (patch) | |
tree | 3b4cf46d14b1c04a34a106ca55cca7b0cc00bd87 /Command/Move.hs | |
parent | 9a4127f0fed9fa9cd684fff78b3a2af9da3c62ad (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/Move.hs')
-rw-r--r-- | Command/Move.hs | 10 |
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 |