Skip to content

Globstar returns its parent directory as a match when it should not #21

Closed
@e2tha-e

Description

@e2tha-e

When trying to match the contents of a parent directory, using a globstar returns the parent as a match. This does not abide by the behavior of globstars in BASH.

Environment

shell BASH
node v12.1.0
picomatch v2.0.7

Sample code

bash:

mkdir foo
touch foo/bar
ls foo/**

node:

const picomatch = require('picomatch');
const isMatch = picomatch('foo/**');
const foo = 'foo';
const bar = 'foo/bar';
console.log(foo, isMatch(foo));
console.log(bar, isMatch(bar));

Expected result

bash:

foo/bar

node:

foo false
foo/bar true

Actual result

bash:

foo/bar

node:

foo true
foo/bar true

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions