sindresorhus / globby

User-friendly glob matching
MIT License
2.51k stars 130 forks source link

Duplicated results when directory specified with globstar #175

Closed aeisenberg closed 2 years ago

aeisenberg commented 3 years ago

Here's a situation that I've come across. There is a directory a that has a single file in it, a/b. The following program shows that globby will return the file twice (once with a leading ./ and once without. However, fast-glob only returns this file once.

const g = require('globby')
const f = require('fast-glob')

console.log(g.sync(['./a','./a/**'])) // [ 'a/b', './a/b' ]
console.log(f.sync(['./a','./a/**'])) // [ './a/b' ]

When this is run without the leading ./ both globby and fast-glob return the file only once. I think fast-glob is the correct behaviour.

Using v11.0.3 of globby. And v3.2.5 of fast-glob.

sindresorhus commented 3 years ago

Yeah, this is a globby bug.