fast-glob
fast-glob copied to clipboard
There are duplicates when using non-normalized paths in patterns
Environment
- OS Version: macOS 10.14
- Node.js Version: 8.11.4
Actual behavior
The output of fast-glob contains duplicates when using non-normalized paths in patterns (like ./file.txt
).
Expected behavior
Duplicates should be avoided.
Steps to reproduce & code sample
Let's assume the working directory contains the following files: file1.txt
and file2.txt
fastGlob.sync(['*', './file1.txt'])
// returns ['./file1.txt', 'file2.txt', 'file1.txt']
// where I'm expecting ['file1.txt', 'file2.txt']
I just wanted to raise the issue, though I'm not sure if this is an actual bug or if it's wanted.
Cheers
Will be covered by fast-glob@3
.
node-glob
does not exclude results from similar patterns.
After several approaches:
- We don't know which pattern is similar to the other, so we can't drop it from input.
- In order to say for sure that one path is similar to the other, you need to get the full path (
path.resolve
). This is a very expensive operation. Unfortunately, I'm not interested in slowing down this place now.
But I understand that this is not a user-friendly way.
I suggest we make the following steps:
- In
3.x.x
normalize the path in the entry filter when theunique
option is enabled. Right now this is the primary cause of the problem (we don't normalize./
). - In
4.x.x
back to the discussion of the problem.
Right now moved to 3.1.0
.
The problem with a leading dot has been solved in the master branch by #402. Other issues will be considered separately as they appear as issues.
Will be shipped with 3.3.0
.