From cbfcd75214a648bf204f8356a28e360229542bde Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 26 Feb 2013 13:49:22 -0400 Subject: fix * glob matching files in subdirectories --- Limit.hs | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) (limited to 'Limit.hs') diff --git a/Limit.hs b/Limit.hs index df188e3df..1d02decbe 100644 --- a/Limit.hs +++ b/Limit.hs @@ -12,12 +12,8 @@ module Limit where import Data.Time.Clock.POSIX import qualified Data.Set as S import qualified Data.Map as M -#ifdef WITH_GLOB -import "Glob" System.FilePath.Glob (simplify, compile, match) -#else -import Text.Regex.PCRE.Light.Char8 import System.Path.WildMatch -#endif +import Text.Regex import Common.Annex import qualified Annex @@ -86,18 +82,14 @@ addExclude = addLimit . limitExclude limitExclude :: MkLimit limitExclude glob = Right $ const $ return . not . matchglob glob +{- Could just use wildCheckCase, but this way the regex is only compiled + - once. -} matchglob :: String -> Annex.FileInfo -> Bool matchglob glob (Annex.FileInfo { Annex.matchFile = f }) = -#ifdef WITH_GLOB - match pattern f + isJust $ matchRegex cregex f where - pattern = simplify $ compile glob -#else - isJust $ match cregex f [] - where - cregex = compile regex [] + cregex = mkRegex regex regex = '^':wildToRegex glob -#endif {- Adds a limit to skip files not believed to be present - in a specfied repository. -} -- cgit v1.2.3