Fail-fast on children of negated glob directory matches like Git does
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 5.9k
- Forks
- 1.8k
- PR merge metrics
- No merged PRs in 30d
Description
Describe the enhancement
The default globbing technique investigates all paths, even ones that have already been invalidated by negated matchers:
https://github.com/actions/toolkit/blob/1cc56db0ff126f4d65aeb83798852e02a2c180c3/packages/glob/src/internal-pattern-helper.ts#L59-L81
This differs from Git's globbing technique used in the .gitignore files here:
It is not possible to re-include a file if a parent directory of that file is excluded. Git doesn’t list excluded directories for performance reasons, so any patterns on contained files have no effect, no matter where they are defined.
This is unintuitive because many developers are already familiar with Git's globbing style and can inadvertently introduce performance problems by including arbitrary folders and trying (and failing) to exclude certain large directories.
Additional information
https://github.com/limjh16/jekyll-action-ts/issues/3#issuecomment-663949727 describes a significant performance penalty from searching everywhere for a certain file name.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in packages/glob/src/internal-pattern-helper.ts, especially the linked lines 59–81, and trace how negated directory matches are handled. Compare the behavior with Git's documented pattern rules and identify the relevant glob tests to run. Done means children of excluded directories are no longer investigated, matching the stated Git-like behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100