Skip to content

directories should be ignored even without trailing slash #43

@JulienPalard

Description

@JulienPalard

To put it in code, I think that this one shall pass:

    def test_ignore_directory_no_slash(self):
        matches = _parse_gitignore_string('.venv', fake_base_dir='/home/michael')
        self.assertTrue(matches('/home/michael/.venv'))
        self.assertTrue(matches('/home/michael/.venv/folder'))
        self.assertTrue(matches('/home/michael/.venv/file.txt'))

Because according to man gitignore:

$ man gitignore | grep 'If there is a separator at the end of the pattern'
       •   If there is a separator at the end of the pattern then the pattern will only match directories, otherwise the pattern can match both files and directories.

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