From 4868b64868747455a9c5d512650f9e7074e6009e Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 27 Mar 2011 18:34:30 -0400 Subject: 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. --- Command/Move.hs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'Command/Move.hs') 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 -- cgit v1.2.3