diff options
author | Joey Hess <joey@kitenet.net> | 2013-02-26 13:49:22 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-02-26 14:35:39 -0400 |
commit | cbfcd75214a648bf204f8356a28e360229542bde (patch) | |
tree | 4b63d28522c4c73dc4847d66fffe1bcf3864c0b9 /Limit.hs | |
parent | c7e198390bfe3911943bc74836d7519c5ae37674 (diff) |
fix * glob matching files in subdirectories
Diffstat (limited to 'Limit.hs')
-rw-r--r-- | Limit.hs | 18 |
1 files changed, 5 insertions, 13 deletions
@@ -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. -} |