diff options
author | Joey Hess <joey@kitenet.net> | 2011-09-18 17:47:49 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-09-18 17:47:49 -0400 |
commit | 8a5a92480b9dcf691af1e8c4849cb71c4158b845 (patch) | |
tree | 04a240460520e892532ca8363a71454538e16e6f /Command.hs | |
parent | 38c0f3eaf86b67d584d4ff30ab15ec2c725a7fad (diff) |
refactor --exclude to use Utility.Matcher
This should change no behavior, but opens the poissibility to use the
matcher for other sorts of limits on which files git-annex processes.
Diffstat (limited to 'Command.hs')
-rw-r--r-- | Command.hs | 21 |
1 files changed, 1 insertions, 20 deletions
diff --git a/Command.hs b/Command.hs index 08087a5a5..fd58ca801 100644 --- a/Command.hs +++ b/Command.hs @@ -12,11 +12,8 @@ import System.Directory import System.Posix.Files import Control.Monad (filterM, liftM, when) import Control.Applicative -import System.Path.WildMatch -import Text.Regex.PCRE.Light.Char8 import Data.List import Data.Maybe -import Data.String.Utils import Types import qualified Backend @@ -30,6 +27,7 @@ import Trust import LocationLog import Config import Backend +import Limit {- A command runs in four stages. - @@ -180,23 +178,6 @@ withNothing _ _ = error "This command takes no parameters." backendPairs :: (BackendFile -> CommandStart) -> CommandSeek backendPairs a files = map a <$> Backend.chooseBackends files -{- Filter out files those matching the exclude glob pattern, - - if it was specified. -} -filterFiles :: [FilePath] -> Annex [FilePath] -filterFiles l = do - exclude <- Annex.getState Annex.exclude - if null exclude - then return l - else return $ filter (notExcluded $ wildsRegex exclude) l - where - notExcluded r f = isNothing $ match r f [] - -wildsRegex :: [String] -> Regex -wildsRegex ws = compile regex [] - where - regex = "^(" ++ alternatives ++ ")" - alternatives = join "|" $ map wildToRegex ws - {- filter out symlinks -} notSymlink :: FilePath -> IO Bool notSymlink f = liftIO $ not . isSymbolicLink <$> getSymbolicLinkStatus f |