aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarien Hager <dhager@gmi-mr.com>2018-03-30 19:10:55 -0700
committerDarien Hager <dhager@gmi-mr.com>2018-03-30 19:10:55 -0700
commit94ce23bb62c54f888e09e1796380348204e4a2c2 (patch)
treec0ccd174a3a3f9f4df2a4242bd6be6c0de92037d
parentbb795494351d1e2c77912ce7fcddc42433b73565 (diff)
downloadyapf-94ce23bb62c54f888e09e1796380348204e4a2c2.tar.gz
Fix issue with matching against hidden child folders in relative-directory context.
-rw-r--r--yapf/yapflib/file_resources.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/yapf/yapflib/file_resources.py b/yapf/yapflib/file_resources.py
index 5468ced..67eea61 100644
--- a/yapf/yapflib/file_resources.py
+++ b/yapf/yapflib/file_resources.py
@@ -148,7 +148,10 @@ def _FindPythonFiles(filenames, recursive, exclude):
def IsIgnored(path, exclude):
"""Return True if filename matches any patterns in exclude."""
- return any(fnmatch.fnmatch(path.lstrip('./'), e.rstrip('/')) for e in exclude)
+ path = path.lstrip("/")
+ while path.startswith("./"):
+ path = path[2:]
+ return any(fnmatch.fnmatch(path, e.rstrip('/')) for e in exclude)
def IsPythonFile(filename):