zach-overflow commented on code in PR #56509:
URL: https://github.com/apache/airflow/pull/56509#discussion_r2417953463


##########
airflow-core/src/airflow/utils/file.py:
##########
@@ -102,24 +102,21 @@ def compile(pattern: str, base_dir: Path, 
definition_file: Path) -> _IgnoreRule
             relative_to = definition_file.parent
 
         ignore_pattern = GitWildMatchPattern(pattern)
-        return _GlobIgnoreRule(ignore_pattern, relative_to)
+        return _GlobIgnoreRule(wild_match_pattern=ignore_pattern, 
relative_to=relative_to)
 
     @staticmethod
     def match(path: Path, rules: list[_IgnoreRule]) -> bool:
-        """Match a list of ignore rules against the supplied path."""
+        """Match a list of ignore rules against the supplied path, accounting 
for exclusion rules and ordering."""
         matched = False
-        for r in rules:
-            if not isinstance(r, _GlobIgnoreRule):
-                raise ValueError(f"_GlobIgnoreRule cannot match rules of type: 
{type(r)}")
-            rule: _GlobIgnoreRule = r  # explicit typing to make mypy play 
nicely
+        for rule in rules:
+            if not isinstance(rule, _GlobIgnoreRule):
+                raise ValueError(f"_GlobIgnoreRule cannot match rules of type: 
{type(rule)}")
             rel_path = str(path.relative_to(rule.relative_to) if 
rule.relative_to else path.name)
-            matched = rule.wild_match_pattern.match_file(rel_path) is not None
-
-            if matched:
-                if not rule.wild_match_pattern.include:
-                    return False
-
-                return matched
+            if (
+                rule.wild_match_pattern.include is not None

Review Comment:
   I'd appreciate any input on this condition, as it is a bit unclear what the 
expected behavior is for the situation when `rule.wild_match_pattern.include` 
is `None`. The `pathspec.pattern.Pattern` docstring leaves this a bit vague IMO:
   
   > *include* (:class:`bool` or :data:`None`) is whether the matched files
                should be included (:data:`True`), excluded (:data:`False`), or 
is a
                null-operation (:data:`None`)



-- 
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]

Reply via email to