Skip to content

exclude .git folder returns a null tree #71

Open
@nik-lus

Description

@nik-lus

I'm on macOs, node v12, directory-tree v2.2.4...

When I try to create a directory tree by excluding the .git folder:

const tree = dirTree(rootPath, { exclude: [/.git/] }); console.log('tree is ', tree)

I get:

tree is null

But when I specify an absolute path to the .git folder:

const tree = dirTree(rootPath, { exclude: [/\/absolute-path-to-folder\/.git/] }); console.log('tree is ', tree)

I get:

tree is Object{...}

I'd like to exclude all .git folders (without having to specify the absolute path to them).

Has anyone else encountered this? Am I using exclude incorrectly (exclude does work as expected on any other folders starting with ' . ' just not '.git')?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions