summaryrefslogtreecommitdiff
path: root/Limit
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-01-18 14:51:55 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-01-18 14:51:55 -0400
commit842ca9c4b684ec21b9e5a99b3742db5f36a1440f (patch)
treeb198d4b4d66dd9497820f0149906df3a5a37e0cd /Limit
parentbeb9bfa4454c46f62e6ecb4bc180b4a33cce6370 (diff)
improve matcher data type to allow matching Keys, instead of just files (no behavior changes)
Diffstat (limited to 'Limit')
-rw-r--r--Limit/Wanted.hs10
1 files changed, 6 insertions, 4 deletions
diff --git a/Limit/Wanted.hs b/Limit/Wanted.hs
index ed4529dea..7e9278202 100644
--- a/Limit/Wanted.hs
+++ b/Limit/Wanted.hs
@@ -13,9 +13,11 @@ import Limit
import Types.FileMatcher
addWantGet :: Annex ()
-addWantGet = addLimit $ Right $ const $
- \fileinfo -> wantGet False (Just $ matchFile fileinfo)
+addWantGet = addLimit $ Right $ const $ checkWant $ wantGet False
addWantDrop :: Annex ()
-addWantDrop = addLimit $ Right $ const $
- \fileinfo -> wantDrop False Nothing (Just $ matchFile fileinfo)
+addWantDrop = addLimit $ Right $ const $ checkWant $ wantDrop False Nothing
+
+checkWant :: (Maybe FilePath -> Annex Bool) -> MatchInfo -> Annex Bool
+checkWant a (MatchingFile fi) = a (Just $ matchFile fi)
+checkWant _ (MatchingKey _) = return False