tweak
This commit is contained in:
parent
6d3df8a083
commit
53677d7647
1 changed files with 4 additions and 5 deletions
|
@ -183,17 +183,16 @@ filterFiles l = do
|
||||||
exclude <- Annex.getState Annex.exclude
|
exclude <- Annex.getState Annex.exclude
|
||||||
if null exclude
|
if null exclude
|
||||||
then return l'
|
then return l'
|
||||||
else do
|
else return $ filter (notExcluded $ wildsRegex exclude) l'
|
||||||
let regexp = compile (wildsRegex exclude) []
|
|
||||||
return $ filter (notExcluded regexp) l'
|
|
||||||
where
|
where
|
||||||
notState f = not $ stateDir `isPrefixOf` f
|
notState f = not $ stateDir `isPrefixOf` f
|
||||||
notExcluded r f = case match r f [] of
|
notExcluded r f = case match r f [] of
|
||||||
Nothing -> True
|
Nothing -> True
|
||||||
Just _ -> False
|
Just _ -> False
|
||||||
|
|
||||||
wildsRegex :: [String] -> String
|
wildsRegex :: [String] -> Regex
|
||||||
wildsRegex ws = "^(" ++ wildsRegex' ws "" ++ ")"
|
wildsRegex ws = compile regex []
|
||||||
|
where regex = "^(" ++ wildsRegex' ws "" ++ ")"
|
||||||
wildsRegex' :: [String] -> String -> String
|
wildsRegex' :: [String] -> String -> String
|
||||||
wildsRegex' [] c = c
|
wildsRegex' [] c = c
|
||||||
wildsRegex' (w:ws) "" = wildsRegex' ws (wildToRegex w)
|
wildsRegex' (w:ws) "" = wildsRegex' ws (wildToRegex w)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue