From 842ca9c4b684ec21b9e5a99b3742db5f36a1440f Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 18 Jan 2014 14:51:55 -0400 Subject: improve matcher data type to allow matching Keys, instead of just files (no behavior changes) --- Limit/Wanted.hs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'Limit') 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 -- cgit v1.2.3