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

There are duplicates when using non-normalized paths in patterns #190

Closed
yannvgn opened this issue May 22, 2019 · 3 comments
Closed

There are duplicates when using non-normalized paths in patterns #190

yannvgn opened this issue May 22, 2019 · 3 comments
Assignees
Milestone

Comments

@yannvgn
Copy link

yannvgn commented May 22, 2019

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

@mrmlnc
Copy link
Owner

mrmlnc commented Jun 7, 2019

Will be covered by fast-glob@3.

@mrmlnc
Copy link
Owner

mrmlnc commented Jun 16, 2019

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:

  1. In 3.x.x normalize the path in the entry filter when the unique option is enabled. Right now this is the primary cause of the problem (we don't normalize ./).
  2. In 4.x.x back to the discussion of the problem.

Right now moved to 3.1.0.

@mrmlnc mrmlnc modified the milestones: 3.0.0, 3.1.0 Jun 16, 2019
@mrmlnc mrmlnc modified the milestones: 3.1.0, 3.x.x Jun 23, 2019
@mrmlnc mrmlnc modified the milestones: 3.x.x, 3.3.0 Jan 8, 2022
@mrmlnc mrmlnc modified the milestones: 3.3.0, 3.x.x May 6, 2023
@mrmlnc mrmlnc modified the milestones: 3.x.x, 3.3.0 May 24, 2023
@mrmlnc
Copy link
Owner

mrmlnc commented May 27, 2023

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.

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

2 participants