Skip to content

Commit 180c2d4

Browse files
committed
update docs
Add clarification for `nocase` behavior. Also, oops, braceExpandMax is set to 10_000 by default, not 1000 as noted in previous commit. Fix: #569
1 parent 37993c8 commit 180c2d4

File tree

1 file changed

+31
-5
lines changed

1 file changed

+31
-5
lines changed

README.md

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -385,11 +385,32 @@ share the previously loaded cache.
385385
`true` on macOS and Windows systems, and `false` on all others.
386386

387387
> [!NOTE]
388-
> `nocase` should only be explicitly set when it is
389-
> known that the filesystem's case sensitivity differs from the
390-
> platform default. If set `true` on case-sensitive file
391-
> systems, or `false` on case-insensitive file systems, then the
392-
> walk may return more or less results than expected.
388+
> `nocase` should only be explicitly set when it is known that
389+
> the filesystem's case sensitivity differs from the platform
390+
> default. If set `true` on case-sensitive file systems, or
391+
> `false` on case-insensitive file systems, then the walk may
392+
> return more or less results than expected.
393+
>
394+
> As a shortcut to avoid excessive `RegExp` creations, `Glob`
395+
> will use string portions as-is to `readdir()` calls while doing
396+
> its traversal. If you are setting a `nocase: true` match on a
397+
> file system that is in fact case sensitive, then this will
398+
> result in matches not being found that you might expect,
399+
> because for example the pattern `Foo/*` will fail to read the
400+
> `FOO/` or `foo/` directories.
401+
>
402+
> On the other hand, if you set `nocase: false` on a
403+
> case-_insensitive_ system, then the opposite problem occurs:
404+
> `Foo/*` will match `foo/bar`, but because we only detect the
405+
> existence of the `foo/` folder by successfully performing a
406+
> `readdir`, there's no way to know what the "real" case is, and
407+
> the match will be reported as `Foo/bar`, using the case of the
408+
> string portion of the glob pattern.
409+
>
410+
> The default is usually correct, however it _is_ possible to
411+
> mount file systems with a different case-sensitivity from the
412+
> host system. If you know this is the case, set this flag
413+
> appropriately to the file system you are searching.
393414
394415
- `maxDepth` Specify a number to limit the depth of the directory
395416
traversal to this many levels below the `cwd`.
@@ -548,6 +569,11 @@ share the previously loaded cache.
548569
> already be added before its ancestor, if multiple or braced
549570
> patterns are used.
550571
572+
- `braceExpandMax` number, defaults to `10_000`. This is the
573+
maximum number of `{x,y,...}` patterns to expand. It is very
574+
unlikely that you'll need more than this, and setting it higher
575+
exposes the system to out-of-memory errors.
576+
551577
## Glob Primer
552578

553579
Much more information about glob pattern expansion can be found

0 commit comments

Comments
 (0)