Pattern **/ matches everything
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 595
- Forks
- 93
- PR merge metrics
- No merged PRs in 30d
Description
Hi.
Using glob version 0.3.0.
The pattern **/ should match all folders recursively. However it seems to also match files. Not sure if this is as intended, however in bash **/ works for matching folders only.
My test (fails on path3):
#[test]
pub fn test_pattern_recursive_dirs() {
let path1 = Path::new("folder/");
let path2 = Path::new("folder/folder/");
let path3 = Path::new("folder/folder/file");
let pattern = Pattern::new("**/").unwrap();
assert!(pattern.matches_path(path1));
assert!(pattern.matches_path(path2));
assert!(!pattern.matches_path(path3));
}
If this is something to be fixed, I can look into it.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the provided test_pattern_recursive_dirs test and the Pattern::new and Pattern::matches_path entry points. Reproduce the behavior for the **/ pattern, then trace how directory and file paths are distinguished. Done means the folder assertions pass and the file assertion for folder/folder/file remains false.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100