Fix using --exclude=.* to not match . and ..

This commit is contained in:
Anthony Sottile 2020-05-07 12:32:25 -07:00
parent 0c3b8045a7
commit 9e67511c69
2 changed files with 9 additions and 1 deletions

View file

@ -448,7 +448,7 @@ def matches_filename(path, patterns, log_message, logger):
if not patterns:
return False
basename = os.path.basename(path)
if fnmatch(basename, patterns):
if basename not in {".", ".."} and fnmatch(basename, patterns):
logger.debug(log_message, {"path": basename, "whether": ""})
return True