summaryrefslogtreecommitdiff
path: root/Annex/Wanted.hs
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 /Annex/Wanted.hs
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 'Annex/Wanted.hs')
-rw-r--r--Annex/Wanted.hs20
1 files changed, 10 insertions, 10 deletions
diff --git a/Annex/Wanted.hs b/Annex/Wanted.hs
index 1d98cc0c2..2500f80d1 100644
--- a/Annex/Wanted.hs
+++ b/Annex/Wanted.hs
@@ -15,19 +15,19 @@ import Types.Remote
import qualified Data.Set as S
{- Check if a file is preferred content for the local repository. -}
-wantGet :: AssociatedFile -> Annex Bool
-wantGet Nothing = return True
-wantGet (Just file) = isPreferredContent Nothing S.empty file
+wantGet :: Bool -> AssociatedFile -> Annex Bool
+wantGet def Nothing = return def
+wantGet def (Just file) = isPreferredContent Nothing S.empty file def
{- Check if a file is preferred content for a remote. -}
-wantSend :: AssociatedFile -> UUID -> Annex Bool
-wantSend Nothing _ = return True
-wantSend (Just file) to = isPreferredContent (Just to) S.empty file
+wantSend :: Bool -> AssociatedFile -> UUID -> Annex Bool
+wantSend def Nothing _ = return def
+wantSend def (Just file) to = isPreferredContent (Just to) S.empty file def
{- Check if a file can be dropped, maybe from a remote.
- Don't drop files that are preferred content. -}
-wantDrop :: Maybe UUID -> AssociatedFile -> Annex Bool
-wantDrop _ Nothing = return True
-wantDrop from (Just file) = do
+wantDrop :: Bool -> Maybe UUID -> AssociatedFile -> Annex Bool
+wantDrop def _ Nothing = return $ not def
+wantDrop def from (Just file) = do
u <- maybe getUUID (return . id) from
- not <$> isPreferredContent (Just u) (S.singleton u) file
+ not <$> isPreferredContent (Just u) (S.singleton u) file def