kittens/diff: move empty pattern check to dir tree walk

This commit is contained in:
Suvayu Ali 2022-06-05 10:10:17 +02:00
parent fbf1ec43c7
commit eea652f1d0
2 changed files with 3 additions and 3 deletions

View File

@ -117,10 +117,10 @@ def collect_files(collection: Collection, left: str, right: str) -> None:
def walk(base: str, names: Set[str], pmap: Dict[str, str]) -> None:
for dirpath, dirnames, filenames in os.walk(base):
if any(fnmatch(dirpath, f"*/{pat}") for pat in collection.ignore_paths):
if any(fnmatch(dirpath, f"*/{pat}") for pat in collection.ignore_paths if pat):
continue
for filename in filenames:
if any(fnmatch(filename, f"{pat}") for pat in collection.file_ignores):
if any(fnmatch(filename, f"{pat}") for pat in collection.file_ignores if pat):
continue
path = os.path.abspath(os.path.join(dirpath, filename))
path_name_map[path] = name = os.path.relpath(path, base)

View File

@ -59,7 +59,7 @@ def syntax_aliases(raw: str) -> Dict[str, str]:
def pattern_list(raw: str) -> List[str]:
return [pat for pat in raw.split(' ') if pat]
return raw.split(' ')
def parse_map(val: str) -> Iterable[KittensKeyDefinition]: