Incorrectly (?) matches files inside directories that do match
See original GitHub issueHello @cpburnz, I’ve looked existing issues but couldn’t find this one. It was initially reported in yamllint issues: https://github.com/adrienverge/yamllint/issues/334 (yamllint uses pathspec).
Considering these files:
file.yaml
dir/
└── dir/file.sql
dir.yaml/
└── dir.yaml/file.sql ← problem here
pathspec.PathSpec.from_lines('gitwildmatch', ['*.yaml'])
does match file.yaml
, dir.yaml
, but also dir.yaml/file.sql
. The latter isn’t what I would expect, because *.yaml
feels like “files that end with .yaml”, not “any file in any path that contains .yaml”.
Is it the expected behavior? If yes, what is the correct pattern for “files that end with .yaml”?
Looking forward to your answer, and thanks for this very useful project 👍
Issue Analytics
- State:
- Created 3 years ago
- Comments:13 (9 by maintainers)
Top Results From Across the Web
recursive glob([**]) incorrectly matches files in subpackages ...
When subdirectories contain subpackages using a BUILD file, the glob does not match, as expected (and documented).
Read more >Test if there are files matching a pattern in order to execute a ...
With zsh , the test for are there files matching a pattern can be written using an anonymous function and the N (for...
Read more >List files not matching a pattern? - bash - Stack Overflow
I guess it happens because the branches expand the outputs of the command inside them. So it becomes an argument list with about...
Read more >How to list files based on matching only part of their filename?
From this directory, I want to know how I could use grep to display files based on part of their filename - for...
Read more >Tips for writing glob patterns in DeepSource configuration
The glob pattern to match all files under the /src/tests/ directory should be written as */tests** — where */ denotes matching a string...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
There will be a way to handle this scenario in the v0.10.0 release. The new class,
GitIgnoreSpec
, will need to be used. It will prioritize patterns that directly match the file over an ancestor directory. It can be used as:Thanks @cpburnz!