diff options
author | Joey Hess <joey@kitenet.net> | 2011-01-30 00:08:17 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-01-30 00:08:17 -0400 |
commit | 53677d764710d522394f59e494fb6b632aca2326 (patch) | |
tree | 8a325fd84da0c89a784ba0173948e278aaa424d9 /Command.hs | |
parent | 6d3df8a0833fdef290b76681e8ba85ec94b76e36 (diff) |
tweak
Diffstat (limited to 'Command.hs')
-rw-r--r-- | Command.hs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/Command.hs b/Command.hs index e54add707..1c1ff6bbc 100644 --- a/Command.hs +++ b/Command.hs @@ -183,17 +183,16 @@ filterFiles l = do exclude <- Annex.getState Annex.exclude if null exclude then return l' - else do - let regexp = compile (wildsRegex exclude) [] - return $ filter (notExcluded regexp) l' + else return $ filter (notExcluded $ wildsRegex exclude) l' where notState f = not $ stateDir `isPrefixOf` f notExcluded r f = case match r f [] of Nothing -> True Just _ -> False -wildsRegex :: [String] -> String -wildsRegex ws = "^(" ++ wildsRegex' ws "" ++ ")" +wildsRegex :: [String] -> Regex +wildsRegex ws = compile regex [] + where regex = "^(" ++ wildsRegex' ws "" ++ ")" wildsRegex' :: [String] -> String -> String wildsRegex' [] c = c wildsRegex' (w:ws) "" = wildsRegex' ws (wildToRegex w) |