- Notifications
You must be signed in to change notification settings - Fork 45
Closed
Description
import pathspec spec = pathspec.GitIgnoreSpec.from_lines([ '*', # Ignore all files by default '!*/', # but scan all directories '!*.txt', # Text files '/test1/**' # ignore all in the directory ]) files = { 'test1/b.bin', 'test1/a.txt', 'test1/c/c.txt', 'test2/a.txt', 'test2/b.bin', 'test2/c/c.txt', } ignores = set(spec.match_files(files)) print(ignores)
{'test1/b.bin', 'test2/b.bin'}
It should be
{'test1/a.txt', 'test1/c/c.txt', 'test1/b.bin', 'test2/b.bin'}
I think GitIgnoreSpec._match_file should have something like:
if pattern.include is False and dir_mark and out_priority == 0: out_matched = pattern.include out_priority = priority elif pattern.include is True and dir_mark: out_matched = pattern.include out_priority = priority elif priority >= out_priority: out_matched = pattern.include out_priority = priority
Metadata
Metadata
Assignees
Labels
No labels