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

Change semantics of tag globs #84

Closed
ArneBachmann opened this issue Jan 29, 2021 · 2 comments
Closed

Change semantics of tag globs #84

ArneBachmann opened this issue Jan 29, 2021 · 2 comments
Assignees
Milestone

Comments

@ArneBachmann
Copy link
Owner

ArneBachmann commented Jan 29, 2021

I just finished the rewrite for the tag globs, but found an issue.
For inclusive globs on the same tag, we have a disjunction of conjunctions (OR of ANDs).
For the exclusive patterns, we rather need a conjunction of disjunctions (AND of ORs).

Reason is, that the disjunction for excluding conjunctions will often exclude nothing, instead of allowing to exclude separate patterns.

Example:
tag1;*;.ext2 excludes all *.ext2 files (remaining, e.g., file1.ext1, filenot1.ext3).
tag1;*;file*1,.ext3 excludes all *.ext3 files that start with file and end with 1.

Since both lines keep half of the files, the disjunction of both keep-lists leads to the exclusion of none instead of all.

@ArneBachmann ArneBachmann self-assigned this Feb 5, 2021
@ArneBachmann ArneBachmann added this to the V0.9 milestone Feb 5, 2021
@ArneBachmann
Copy link
Owner Author

OK, I solved it: If two lines for the same tag include a large number of files like * or .ext1 and exclude different sets, it simply cannot be matched correctly. Exclusion works only properly, if the inclusive patterns are mutually exclusive (disjunct) as well.

And they have to, intuitively, because we might add more and more pattern lines overtime. This cannot work, if any of them is over-generic and covers already more than the one we'd like to add.

To make the inclusive patterns distinct, it may be necessary to use the glob negation pattern [!chars]: https://docs.python.org/3.8/library/fnmatch.html

@ArneBachmann
Copy link
Owner Author

Closing as no need to fix, works as intended, but requires documentation.

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

No branches or pull requests

1 participant