diff options
author | Joey Hess <joey@kitenet.net> | 2013-02-11 16:00:58 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-02-11 16:00:58 -0400 |
commit | 66864d5d99e595e56ed77bd89312abc43d593c83 (patch) | |
tree | 47bb74bc92145c51faf76632785500e1bad3a30e /Limit.hs | |
parent | 4b5aa38d39f4bef06bcbface980584d2654bcd28 (diff) | |
parent | e658dc378eaa14607278cddd30f965ffcff89426 (diff) |
Merge branch 'android'
Diffstat (limited to 'Limit.hs')
-rw-r--r-- | Limit.hs | 16 |
1 files changed, 14 insertions, 2 deletions
@@ -5,13 +5,19 @@ - Licensed under the GNU GPL version 3 or higher. -} +{-# LANGUAGE CPP #-} + module Limit where -import Text.Regex.PCRE.Light.Char8 -import System.Path.WildMatch import Data.Time.Clock.POSIX import qualified Data.Set as S import qualified Data.Map as M +#ifdef WITH_GLOB +import System.FilePath.Glob (simplify, compile, match) +#else +import Text.Regex.PCRE.Light.Char8 +import System.Path.WildMatch +#endif import Common.Annex import qualified Annex @@ -82,10 +88,16 @@ limitExclude glob = Right $ const $ return . not . matchglob glob matchglob :: String -> Annex.FileInfo -> Bool matchglob glob (Annex.FileInfo { Annex.matchFile = f }) = +#ifdef WITH_GLOB + match pattern f + where + pattern = simplify $ compile glob +#else isJust $ match cregex f [] where cregex = compile regex [] regex = '^':wildToRegex glob +#endif {- Adds a limit to skip files not believed to be present - in a specfied repository. -} |