Skip to content

On bracket expression negation #77

@karagenc

Description

@karagenc

^ is escaped, but it works with gitignore.

To test it:

mkdir test && cd test
git init
echo 'a[^b]c' > .gitignore
touch abc azc
git status -u --ignored

Notice that abc doesn't match but azc does match. pathspec's behavior with ^ is inconsistent with Git.

I read:

# POSIX declares that the regex bracket expression negation

But I didn't understand why would you prefer to be compatible with POSIX and Python's fnmatch.translate when you could be compatible with gitignore itself. May I ask what led you to the decision to escape ^?

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