fs: apply function exclude to glob results#63049
Open
Kelpy2004 wants to merge 1 commit intonodejs:mainfrom
Open
fs: apply function exclude to glob results#63049Kelpy2004 wants to merge 1 commit intonodejs:mainfrom
Kelpy2004 wants to merge 1 commit intonodejs:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Function-form
excludecallbacks were applied while queuing subpatterns, but some terminal result paths were added directly to the result set. That meant files matched by terminal**or terminal child patterns could bypass anexclude(path)callback that matched the full relative path.For example,
globSync('**', { cwd, exclude: (path) => path === 'a/skip.txt' })could still includea/skip.txt.This routes result additions through a shared helper that applies function-form excludes before recording sync and async glob results, while preserving the existing array-exclude filtering in
ResultSet.Added coverage for:
fs.globSync()fs.glob()fs.promises.glob()**resultsValidation performed locally:
node --check lib/internal/fs/glob.jsnode --check test/parallel/test-fs-glob.mjsI could not run the patched Node test binary because this sparse checkout does not include a built local
nodeexecutable.