Kill the surviving glob and breach-directory mutants of item 370
This commit is contained in:
@@ -121,10 +121,7 @@ def globbed(glob: str, searched: str, path: pathlib.Path) -> bool:
|
||||
return False
|
||||
if UNMATCHED.search(glob):
|
||||
return True
|
||||
if glob.startswith("!"):
|
||||
# It only excludes files.
|
||||
return False
|
||||
anchored = glob.lstrip("/") if "/" in glob else f"**/{glob}"
|
||||
anchored = glob.removeprefix("/") if "/" in glob else f"**/{glob}"
|
||||
# A `**` that is not a whole folder name matches as `*` in ripgrep; crossing folders there only refuses more.
|
||||
translated = {"**/": "(?:.*/)?", "**": ".*", "*": "[^/]*", "?": "[^/]"}
|
||||
pattern = "".join(translated.get(piece, re.escape(piece)) for piece in re.split(r"(\*\*/|\*\*|\*|\?)", anchored))
|
||||
|
||||
Reference in New Issue
Block a user