packages feed

Glob 0.9.3 → 0.10.0

raw patch · 5 files changed

+25/−9 lines, 5 filesdep ~semigroupsPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: semigroups

API changes (from Hackage documentation)

Files

CHANGELOG.txt view
@@ -1,3 +1,8 @@+0.10.0, 2018-12-19:+	Bug fix: "**/" matched hidden directories in some scenarios even when+	         matchDotsImplicitly was set to False.+	         Thanks to Travis Sunderland for the report as well as the fix.+ 0.9.3, 2018-09-22: 	Updated dependencies to allow containers-0.7 (GHC 8.6). Thanks to 	chessai for the merge request.
CREDITS.txt view
@@ -4,3 +4,4 @@ Stephen Hicks Matti Niemenmaa Masahiro Sakai+Travis Sunderland
Glob.cabal view
@@ -1,7 +1,7 @@ Cabal-Version: >= 1.9.2  Name:        Glob-Version:     0.9.3+Version:     0.10.0 Homepage:    http://iki.fi/matti.niemenmaa/glob/ Synopsis:    Globbing library Category:    System
System/FilePath/Glob/Match.hs view
@@ -6,6 +6,8 @@  import Control.Exception (assert) import Data.Char         (isDigit, toLower, toUpper)+import Data.List         (findIndex)+import Data.Maybe        (fromMaybe, isJust) #if !MIN_VERSION_base(4,8,0) import Data.Monoid       (mappend) #endif@@ -122,14 +124,16 @@ match' o again@(AnyNonPathSeparator:xs) path@(c:cs) =    match' o xs path || (not (isPathSeparator c) && match' o again cs) -match' o again@(AnyDirectory:xs) path =-   let parts   = pathParts (dropWhile isPathSeparator path)-       matches = any (match' o xs) parts || any (match' o again) (tail parts)-    in if null xs && not (matchDotsImplicitly o)-          --  **/ shouldn't match foo/.bar, so check that remaining bits don't-          -- start with .-          then all (not.isExtSeparator.head) (init parts) && matches-          else matches+match' o (AnyDirectory:xs) path =+   if matchDotsImplicitly o+      then hasMatch+      --  **/baz shouldn't match foo/.bar/baz, so check that none of the+      -- directories matched by **/ start with .+      else hasMatch && all (not.isExtSeparator.head) matchedDirs+ where parts   = pathParts (dropWhile isPathSeparator path)+       matchIndex = findIndex (match' o xs) parts+       hasMatch = isJust matchIndex+       matchedDirs = take (fromMaybe 0 matchIndex) parts  match' o (LongLiteral len s:xs) path =    let (pre,cs) = splitAt len path
tests/Tests/Regression.hs view
@@ -141,6 +141,12 @@    , (False, "<-><->"     , "1")    , (True,  "<0-0><1-1>" , "01")    , (True,  "<0-1><0-1>" , "00")+   , (False, "a/**/d"     , "a/.b/c/d")+   , (False, "a/**/d"     , "a/b/.c/d")+   , (True,  "a/**/.d"    , "a/b/c/.d")+   , (True,  "a/**/.c/d"  , "a/b/.c/d")+   , (True,  "a/**/.c/.d" , "a/b/.c/.d")+   , (True,  "a/**/.d/.e" , "a/b/c/.d/.e")    ]  matchWithCases :: [(Bool, CompOptions, MatchOptions, String, String)]