summaryrefslogtreecommitdiff
path: root/Limit.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-09-18 20:41:51 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-09-18 20:42:15 -0400
commit33cd1ffbfe200188a4fc61fd5715e7aa29556d7f (patch)
treeb21be384c89e29e2b56e5e1c5e1a931871837c27 /Limit.hs
parent9da23dff78d80158ba01a271ac2a32830fd9bccc (diff)
make find show files meeting limits, even when not present
find: Rather than only showing files whose contents are present, when used with --exclude --copies or --in, displays all files that match the specified conditions. Note that this is a behavior change for find --exclude! Old behavior can be gotten with find --in . --exclude=...
Diffstat (limited to 'Limit.hs')
-rw-r--r--Limit.hs5
1 files changed, 5 insertions, 0 deletions
diff --git a/Limit.hs b/Limit.hs
index 4aeb8bafb..51f3fc950 100644
--- a/Limit.hs
+++ b/Limit.hs
@@ -10,6 +10,7 @@ module Limit where
import Text.Regex.PCRE.Light.Char8
import System.Path.WildMatch
import Control.Monad (filterM)
+import Control.Applicative
import Data.Maybe
import Annex
@@ -27,6 +28,10 @@ filterFiles l = do
matcher <- getMatcher
filterM (Utility.Matcher.matchM matcher) l
+{- Checks if there are user-specified limits. -}
+limited :: Annex Bool
+limited = (not . Utility.Matcher.matchesAny) <$> getMatcher
+
{- Gets a matcher for the user-specified limits. The matcher is cached for
- speed; once it's obtained the user-specified limits can't change. -}
getMatcher :: Annex (Utility.Matcher.Matcher (FilePath -> Annex Bool))