potiuk commented on code in PR #23535:
URL: https://github.com/apache/airflow/pull/23535#discussion_r875911025
##########
airflow/utils/file.py:
##########
@@ -57,19 +60,18 @@ class _RegexpIgnoreRule(NamedTuple):
def compile(pattern: str, base_dir: Path, definition_file: Path) ->
Optional[_IgnoreRule]:
"""Build an ignore rule from the supplied regexp pattern and log a
useful warning if it is invalid"""
try:
- return _RegexpIgnoreRule(re.compile(pattern), base_dir.resolve())
+ return _RegexpIgnoreRule(re.compile(pattern), base_dir)
except re.error as e:
log.warning("Ignoring invalid regex '%s' from %s: %s", pattern,
definition_file, e)
return None
@staticmethod
def match(path: Path, rules: List[_IgnoreRule]) -> bool:
"""Match a list of ignore rules against the supplied path"""
- test_path: Path = path.resolve()
for rule in rules:
if not isinstance(rule, _RegexpIgnoreRule):
raise ValueError(f"_RegexpIgnoreRule cannot match rules of
type: {type(rule)}")
- if rule.pattern.search(str(test_path.relative_to(rule.base_dir)))
is not None:
+ if rule.pattern.search(str(path.relative_to(rule.base_dir))) is
not None:
Review Comment:
Ah yeah... 🤦 - the whole point here was to ignore symlinks.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]