summaryrefslogtreecommitdiff
path: root/Command
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-12-06 13:22:16 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-12-06 13:22:16 -0400
commit2a04e215e10469ee3bab5d1a5d6d76b0c35cc46c (patch)
tree41328caa30ae494316d20e1a5e5909b29aa94516 /Command
parent53304252ca5483ce80f5a66bb74cc9f0732f65d7 (diff)
--auto fixes
* get/copy --auto: Transfer data even if it would exceed numcopies, when preferred content settings want it. * drop --auto: Fix dropping content when there are no preferred content settings.
Diffstat (limited to 'Command')
-rw-r--r--Command/Copy.hs13
-rw-r--r--Command/Drop.hs2
-rw-r--r--Command/Get.hs4
3 files changed, 10 insertions, 9 deletions
diff --git a/Command/Copy.hs b/Command/Copy.hs
index dd5599264..6967c2f93 100644
--- a/Command/Copy.hs
+++ b/Command/Copy.hs
@@ -26,10 +26,11 @@ seek = [withField Command.Move.toOption Remote.byName $ \to ->
- However, --auto mode avoids unnecessary copies, and avoids getting or
- sending non-preferred content. -}
start :: Maybe Remote -> Maybe Remote -> FilePath -> (Key, Backend) -> CommandStart
-start to from file (key, backend) = autoCopies file key (<) $
- stopUnless shouldCopy $
- Command.Move.start to from False file (key, backend)
+start to from file (key, backend) = stopUnless shouldCopy $
+ Command.Move.start to from False file (key, backend)
where
- shouldCopy = case to of
- Nothing -> checkAuto $ wantGet (Just file)
- Just r -> checkAuto $ wantSend (Just file) (Remote.uuid r)
+ shouldCopy = checkAuto (check <||> numCopiesCheck file key (<))
+ check = case to of
+ Nothing -> wantGet False (Just file)
+ Just r -> wantSend False (Just file) (Remote.uuid r)
+
diff --git a/Command/Drop.hs b/Command/Drop.hs
index e7b52124f..a9eec7825 100644
--- a/Command/Drop.hs
+++ b/Command/Drop.hs
@@ -32,7 +32,7 @@ seek = [withField fromOption Remote.byName $ \from ->
start :: Maybe Remote -> FilePath -> (Key, Backend) -> CommandStart
start from file (key, _) = autoCopiesWith file key (>) $ \numcopies ->
- stopUnless (checkAuto $ wantDrop (Remote.uuid <$> from) (Just file)) $
+ stopUnless (checkAuto $ wantDrop False (Remote.uuid <$> from) (Just file)) $
case from of
Nothing -> startLocal file numcopies key Nothing
Just remote -> do
diff --git a/Command/Get.hs b/Command/Get.hs
index 7f02e7935..1295cdeeb 100644
--- a/Command/Get.hs
+++ b/Command/Get.hs
@@ -24,8 +24,8 @@ seek = [withField Command.Move.fromOption Remote.byName $ \from ->
withFilesInGit $ whenAnnexed $ start from]
start :: Maybe Remote -> FilePath -> (Key, Backend) -> CommandStart
-start from file (key, _) = stopUnless ((not <$> inAnnex key) <&&> checkAuto (wantGet $ Just file)) $
- autoCopies file key (<) $
+start from file (key, _) = stopUnless (not <$> inAnnex key) $
+ stopUnless (checkAuto (numCopiesCheck file key (<) <||> wantGet False (Just file))) $ do
case from of
Nothing -> go $ perform key file
Just src ->