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=...
This commit is contained in:
Joey Hess 2011-09-18 20:41:51 -04:00
parent 9da23dff78
commit 33cd1ffbfe
5 changed files with 29 additions and 5 deletions

View file

@ -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))