Skip to content

Commit 4c7eef5

Browse files
committed
Adding patch to allow symlinks in git-sync pathes without error und siblings
1 parent a6df3a5 commit 4c7eef5

1 file changed

Lines changed: 47 additions & 0 deletions

File tree

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
From d4fbd04b62be431484dfbffe1975e57c72d9325a Mon Sep 17 00:00:00 2001
2+
From: Maxi Wittich <maximilian.wittich@stackable.tech>
3+
Date: Fri, 6 Mar 2026 09:31:15 +0100
4+
Subject: Adding patch
5+
6+
---
7+
airflow-core/src/airflow/utils/file.py | 25 +++++++++++++++++--------
8+
1 file changed, 17 insertions(+), 8 deletions(-)
9+
10+
diff --git a/airflow-core/src/airflow/utils/file.py b/airflow-core/src/airflow/utils/file.py
11+
index 76cdf846fe..3eeb367533 100644
12+
--- a/airflow-core/src/airflow/utils/file.py
13+
+++ b/airflow-core/src/airflow/utils/file.py
14+
@@ -203,16 +203,25 @@ def _find_path_from_directory(
15+
# evaluation order of patterns is important with negation
16+
# so that later patterns can override earlier patterns
17+
18+
- dirs[:] = [subdir for subdir in dirs if not ignore_rule_type.match(Path(root) / subdir, patterns)]
19+
- # explicit loop for infinite recursion detection since we are following symlinks in this walk
20+
- for sd in dirs:
21+
- dirpath = (Path(root) / sd).resolve()
22+
+ dirs_sorted = sorted(dirs, key=lambda d: not (Path(root) / d).is_symlink())
23+
+ accepted_dirs: list[str] = []
24+
+ for subdir in dirs_sorted:
25+
+ if ignore_rule_type.match(Path(root) / subdir, patterns):
26+
+ continue
27+
+ dirpath = (Path(root) / subdir).resolve()
28+
if dirpath in patterns_by_dir:
29+
- raise RuntimeError(
30+
- "Detected recursive loop when walking DAG directory "
31+
- f"{base_dir_path}: {dirpath} has appeared more than once."
32+
+ log.debug(
33+
+ "Skipping %s: already visited via resolved path %s. "
34+
+ "This is expected when a symlink and its target are siblings "
35+
+ "(e.g. a git-sync versioned directory alongside its 'link' symlink). ",
36+
+ Path(root) / subdir,
37+
+ dirpath,
38+
)
39+
- patterns_by_dir.update({dirpath: patterns.copy()})
40+
+ continue
41+
+ patterns_by_dir[dirpath] = patterns.copy()
42+
+ accepted_dirs.append(subdir)
43+
+ # Only adding unique subdirs
44+
+ dirs[:] = accepted_dirs
45+
46+
for file in files:
47+
if file != ignore_file_name:

0 commit comments

Comments
 (0)