Skip to content

Need Support of pattern **folder #57

@genoud

Description

@genoud

The pattern **folder is currently not respected. This pattern is not documented in the official git documentation here https://git-scm.com/docs/gitignore but is enforced by git and is different from the pattern **/folder.

The difference

**/subfolder \n
!folder/subfolder/testFile.txt

Will ignore the folder subfolder and the negation pattern will not work, as explained in the gitignore documentation.

It is not possible to re-include a file if a parent directory of that file is excluded.

While with those lines the file folder/subfolder/testFile.txt will be re-included as the pattern **subfolder does not match the folder subfolder but any file containing the string subfolder.

**subfolder
!folder/subfolder/testFile.txt

Actual behaviour:

const ignore = require('ignore') ;
const ig = ignore().add(['**subfolder']);

let isIgnored = ig.ignores('folder/subfolder/testFile.txt') // false

const ignore = require('ignore') ;
const ig = ignore().add(['**/subfolder']);

let isIgnored = ig.ignores('folder/subfolder/testFile.txt') // true

Expected behaviour

const ignore = require('ignore') ;
const ig = ignore().add(['**subfolder']);

let isIgnored = ig.ignores('folder/subfolder/testFile.txt') // true

const ignore = require('ignore') ;
const ig = ignore().add(['**/subfolder']);

let isIgnored = ig.ignores('folder/subfolder/testFile.txt') // true

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