Skip to content

Commit d153e70

Browse files
authored
Merge pull request #40 from facelessuser/bugfix
Glob bug fixes
2 parents e50a7ea + 2ee0a78 commit d153e70

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

docs/src/markdown/changelog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## 3.0.2
4+
5+
- **FIX**: Fix an offset issue when processing an absolute path pattern in `glob` on Linux or macOS.
6+
- **FIX**: Fix an issue where the `glob` command would use `GLOBSTAR` logic on `**` even when `GLOBSTAR` was disabled.
7+
38
## 3.0.1
49

510
- **FIX**: In the `WcMatch` class, defer hidden file check until after the file or directory is compared against patterns to potentially avoid calling hidden if the pattern doesn't match. The reduced `lstat` calls improve performance.

wcmatch/__meta__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,5 +186,5 @@ def parse_version(ver, pre=False):
186186
return Version(major, minor, micro, release, pre, post, dev)
187187

188188

189-
__version_info__ = Version(3, 0, 1, "final")
189+
__version_info__ = Version(3, 0, 2, "final")
190190
__version__ = __version_info__._get_canonical()

wcmatch/_wcparse.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ def __init__(self, pattern, flags):
290290
self.unix = is_unix_style(flags)
291291
self.flags = flags
292292
self.pattern = util.norm_pattern(pattern, not self.unix, flags & RAWCHARS)
293+
self.globstar = bool(flags & GLOBSTAR)
293294
if is_negative(self.pattern, flags): # pragma: no cover
294295
# This isn't really used, but we'll keep it around
295296
# in case we find a reason to directly send inverse patterns
@@ -404,7 +405,7 @@ def store(self, value, l, dir_only):
404405
if l and value in (b'', ''):
405406
return
406407

407-
globstar = value in (b'**', '**')
408+
globstar = value in (b'**', '**') and self.globstar
408409
magic = self.is_magic(value)
409410
if magic:
410411
value = compile(value, self.flags)
@@ -438,8 +439,8 @@ def split(self):
438439
i.advance(2)
439440
elif not self.win_drive_detect and pattern.startswith('/'):
440441
parts.append(WcGlob(b'/' if self.is_bytes else '/', False, False, True, True))
441-
start = 1
442-
i.advance(2)
442+
start = 0
443+
i.advance(1)
443444

444445
for c in i:
445446
if self.extend and c in EXT_TYPES and self.parse_extend(c, i):

0 commit comments

Comments
 (0)