Skip to content

Add the allofany matching type (#423) - #487

Closed
dfandrich wants to merge 1 commit into
actions:mainfrom
dfandrich:allofany
Closed

dfandrich wants to merge 1 commit into
actions:mainfrom
dfandrich:allofany

Conversation

@dfandrich

Copy link
Copy Markdown
Contributor

This is true when all files match any of the patterns.

This is true when all files match any of the patterns.
@dfandrich
dfandrich requested a review from a team as a code owner January 20, 2023 21:13
@hstoresin

Copy link
Copy Markdown

npm run verify -- --tree=merkle-tree.json --hash=08a72001307d26afe079f6582ea5aacbeb7e1a01

@dfandrich

Copy link
Copy Markdown
Contributor Author

It would be nice to get this into v5. I count 3 open issues that this feature would address, plus my own use case.

@silverwind

silverwind commented Sep 11, 2023 •

Copy link
Copy Markdown
Contributor

I would call this filter only, e.g. it only matches when all specified globs match exactly, with no unmatched files present in the changeset, like in this table:

change files a a,b a,b,c
all: [a, b] ❌ ✅ ✅
only: [a, b] ❌ ✅ ❌
any: [a, b] ✅ ✅ ✅

Is it how this works?

@silverwind silverwind mentioned this pull request Sep 11, 2023
@dfandrich

Copy link
Copy Markdown
Contributor Author

I don't think that table is accurate, if I'm reading it correctly (where each glob [a, b] matches a single, different file). If I make the globs look like globs for clarity of this interpretation, the table would be:

changed files a a,b a,b,c
all: [a*, b*] ❌ ❌ ❌
allofany: [a*, b*] ✅ ✅ ❌
any: [a*, b*] ❌ ✅ ✅

The all case can never match anything because a* and b* are disjunct globs, so maybe I misinterpreted your version of the table.

While I'm not married to the name, it should be consistent with the existing operators. any and all refer to how many paths must match the globs, whereas only doesn't fit that pattern since it doesn't say anything about the paths.

@dfandrich

Copy link
Copy Markdown
Contributor Author

This PR has been superseded by #680.

@dfandrich dfandrich closed this Oct 31, 2023
@brianluckham

Copy link
Copy Markdown

dfandrich:allofany

@dfandrich

Copy link
Copy Markdown
Contributor Author

Note that the semantics of PR #680 turn out not to match this PR's. AnyGlobMatchesAllFiles is not the same as allofany. It sounds like it should be, but AnyGlobMatchesAllFiles has the semantics of OneGlobMatchesAllFiles instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot represent matching all files against multiple patterns

4 participants