-
Notifications
You must be signed in to change notification settings - Fork 172
fix!: replace custom glob with minimatch for improved pattern matching #750
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix!: replace custom glob with minimatch for improved pattern matching #750
Conversation
9232961
to
b3aba96
Compare
b3aba96
to
a247e01
Compare
Note: This PR doesn't impact:
|
This is great! But requires some manual resolution of conflicts. So will merge it after handling a few simpler PR merges. |
Let me know if (and when) you need help to resolve conflicts. |
Thanks @PendaGTP if you could look at that it would be awesome. It is mostly the code you have contibuted in the previous PRs and this, so it would be easier for you. |
a247e01
to
99509e8
Compare
@decyjphr fyi rebase done |
I do want to comment that this fix by @PendaGTP works much better than the recent #808 merge when it comes to mistaken globbing issues. Basically as it stands with current
Then it will be greedy and pull in any repos that match "luv" in any part of the repo name, whereas in this PR, the behavior is that this config would only match the repo called "luv" and that's all. Testing
This will match any repo that starts with "luv", for example: "luv-mike-repo" will match.
Our team is good with this behavior, just pointing out that we also tested this scenario. Background
|
@PendaGTP wondering if you have seen this error before
Trying to test this before merging it. |
f230fbe
to
7be3344
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Replace the custom glob implementation with minimatch
-based matching and remove legacy regex support, updating all related logic, tests, and documentation.
- Swap custom
Glob
regex logic forminimatch
inlib/glob.js
and update callers - Simplify include/exclude filtering in settings and plugin code
- Remove old glob tests, adjust config tests and documentation to use glob syntax
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
lib/glob.js | Replaced regex-based glob with minimatch calls |
lib/settings.js | Updated includesRepo to use new Glob.test , fixed backward-compat logic and typo |
lib/plugins/diffable.js | Simplified exclude/include filtering using Glob.test |
index.js | Refactored file-matching functions to use glob patterns and removed inline regex |
test/unit/lib/settings.test.js | Updated test patterns from regex to glob syntax |
test/unit/lib/glob.test.ts | Removed obsolete custom glob tests—needs replacement |
README.md | Updated usage docs to reflect glob-based patterns |
Comments suppressed due to low confidence (4)
lib/settings.js:459
- Typo in log: "retricted" should be "restricted".
this.log.debug(`Skipping retricted repo ${repoName}`)
test/unit/lib/glob.test.ts:1
- All legacy glob tests were removed; add new unit tests to cover the updated
Glob.test
behavior against various glob patterns.
-const Glob = require('../../../lib/glob')
index.js:136
- [nitpick] This helper appears unused after the refactor in favor of
getMatchingFiles
–based functions. Remove or consolidate to avoid dead code.
function getAllChangedSubOrgConfigs (payload) {
lib/glob.js:1
- Destructuring minimatch like this will be undefined;
require('minimatch')
returns the function itself. Change toconst minimatch = require('minimatch')
orconst { Minimatch } = require('minimatch')
depending on usage.
const { minimatch } = require('minimatch')
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Description
Fixes #748
Replace custom glob implementation with minimatch.
Changes
minimatch
to fully support glob patternsRemoved Regex support for patterns. Users must update their configuration to use glob syntax.
Before:
After:
This change simplifies the configuration and doesn't significantly impact existing functionality.
Testing