Skip to content
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

Add the allofany matching type (#423) #487

Closed
wants to merge 1 commit into from

Conversation

dfandrich
Copy link
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

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

@dfandrich
Copy link
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
Copy link
Contributor

silverwind commented Sep 11, 2023

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
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
Contributor Author

This PR has been superseded by #680.

@dfandrich dfandrich closed this Oct 31, 2023
@brianluckham
Copy link

dfandrich:allofany

@dfandrich
Copy link
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