-
Notifications
You must be signed in to change notification settings - Fork 49
Description
I'm using pattern
"""
!test1/
*.txt
"""
to scan a folder, from gitingore description
(http://git-scm.com/book/en/v2/Git-Basics-Recording-Changes-to-the-Repository)
ignore all files in the build/ directory
build/
this should exclude everything under test1 folder, but the run result shows the line dose not work, the result still show all contents under test 1 folder.
[An Example Folder Structure]
d:\dev\eclipse_workspace\test_scan\src\test1\a.txt
d:\dev\eclipse_workspace\test_scan\src\test1\b.txt
d:\dev\eclipse_workspace\test_scan\src\test1\c\c1.txt
d:\dev\eclipse_workspace\test_scan\src\test2\a.txt
d:\dev\eclipse_workspace\test_scan\src\test2\b.txt
d:\dev\eclipse_workspace\test_scan\src\test2\c\c1.txt
[Code]
SCAN_PATTERN = """
!test1/
*.txt
"""
spec = pathspec.PathSpec.from_lines(pathspec.GitIgnorePattern, SCAN_PATTERN.splitlines())
spec.match_tree('d:\dev\eclipse_workspace\test_scan')
[Run Result]
d:\dev\eclipse_workspace\test_scan\src\test1\a.txt
d:\dev\eclipse_workspace\test_scan\src\test1\b.txt
d:\dev\eclipse_workspace\test_scan\src\test1\c\c1.txt
d:\dev\eclipse_workspace\test_scan\src\test2\a.txt
d:\dev\eclipse_workspace\test_scan\src\test2\b.txt
d:\dev\eclipse_workspace\test_scan\src\test2\c\c1.txt
Can you please have a look? Thanks.