diff --git a/.changes/unreleased/Fixes-20241223-155231.yaml b/.changes/unreleased/Fixes-20241223-155231.yaml new file mode 100644 index 0000000..42fa0a0 --- /dev/null +++ b/.changes/unreleased/Fixes-20241223-155231.yaml @@ -0,0 +1,6 @@ +kind: Fixes +body: only get modification time on files that match regex pattern +time: 2024-12-23T15:52:31.73318431-05:00 +custom: + Author: otosky + Issue: astronomer/astronomer-cosmos#1075 diff --git a/dbt_common/clients/system.py b/dbt_common/clients/system.py index 5ab681f..dc77697 100644 --- a/dbt_common/clients/system.py +++ b/dbt_common/clients/system.py @@ -127,14 +127,16 @@ def find_matching( # if ignore_spec.match(relative_dir): # continue for local_file in local_files: + if not reobj.match(local_file): + continue + absolute_path = os.path.join(current_path, local_file) relative_path = os.path.relpath(absolute_path, absolute_path_to_search) relative_path_to_root = os.path.join(relative_path_to_search, relative_path) modification_time = os.path.getmtime(absolute_path) - if reobj.match(local_file) and ( - not ignore_spec or not ignore_spec.match_file(relative_path_to_root) - ): + + if not ignore_spec or not ignore_spec.match_file(relative_path_to_root): matching.append( { "searched_path": relative_path_to_search,