From 09b23627cf5ff37516a60ddc00eba48ed71a6995 Mon Sep 17 00:00:00 2001 From: Oliver Tosky Date: Mon, 23 Dec 2024 15:29:27 -0500 Subject: [PATCH 1/2] fix: only evaluate mtime on matched local files --- dbt_common/clients/system.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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, From 1ba9d3c8b6e0785c275b94e08fc67708c70f63d2 Mon Sep 17 00:00:00 2001 From: Oliver Tosky Date: Mon, 23 Dec 2024 15:52:56 -0500 Subject: [PATCH 2/2] chore: add changelog entry --- .changes/unreleased/Fixes-20241223-155231.yaml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changes/unreleased/Fixes-20241223-155231.yaml 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