Skip to content

Different gitignore pattern interpretations between python-pathspec and Git #93

@tomokinakamaru

Description

@tomokinakamaru

I've noticed that the following four gitignore patterns are interpreted differently between python-pathspec and Git:

pattern path python-pathspec Git
foo**/bar foobar Tracked 1 Ignored
foo foo Tracked 2 Ignored
[ [ Ignored 3 Tracked
[!] [!] Ignored 4 Tracked

In my opinion, Git's behavior here is somewhat confusing, but given the wide use of python-pathspec5, I wanted to report these differences for clarification. Ideally, I would be happy if the python-pathspec follows Git perfectly, but I understand if it behaves differently against these edge cases.

Are these differences expected or known issues?

Footnotes

  1. https://github.com/tomokinakamaru/python-pathspec/blob/e2677495f64a5b19249184b9f1027adac45cd8b8/tests/test_03_pathspec.py#L57-L63 -> test failure

  2. https://github.com/tomokinakamaru/python-pathspec/blob/e2677495f64a5b19249184b9f1027adac45cd8b8/tests/test_03_pathspec.py#L65-L71 -> test failure

  3. https://github.com/tomokinakamaru/python-pathspec/blob/e2677495f64a5b19249184b9f1027adac45cd8b8/tests/test_03_pathspec.py#L73-L79 -> test failure

  4. https://github.com/tomokinakamaru/python-pathspec/blob/e2677495f64a5b19249184b9f1027adac45cd8b8/tests/test_03_pathspec.py#L81-L87 -> test failure

  5. I am concerned that cloud-related tools such as awsebcli, which rely on python-pathspec to determine upload inclusion, could inadvertently upload unintended files to a server.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions