Fix incorrect .airflowignore behavior with multiple nested directories #11994
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem:
In
find_path_from_directory()
, thepatterns_by_dir
map is incorrectly emptied and reset with patterns from the current directory, effectively forgetting about the patterns added earlier, for directories not yet processed. The modified testcase demonstrates the issue.Solution:
Instead of resetting the map, update it with the new entries. An entry for a directory is added only once, namely when its immediate parent directory is processed, therefore we never overwrite any key in the map.
Note:
The test is currently marked as
heisentest
; PR #11993 unmarks it. I imagine that PR should go first, and this PR should be rebased after that.