Skip to content

gitignore /a should differ from 'a' #16

@GerHobbelt

Description

@GerHobbelt

https://git-scm.com/docs/gitignore#_pattern_format

If there is a separator at the beginning or middle (or both) of the pattern, then the pattern is relative to the directory level of the particular .gitignore file itself. Otherwise the pattern may also match at any level below the .gitignore level.

[...]

For example, a pattern doc/frotz/ matches doc/frotz directory, but not a/doc/frotz directory; however frotz/ matches frotz and a/frotz that is a directory (all paths are relative from the .gitignore file).


Now gitignore-parser creates regexes for both which are wrong: only the /a should become /^a/ while a should be turned into a regex like /a/ (or possibly /(^|[\/])a/ ...)

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