Read .graphifyinclude allowlist patterns from root and ancestors. Include patterns opt matching hidden files/dirs into traversal. Sensitive files and hard-skipped noise directories are still excluded later. Uses the same VCS-root ceiling logic as _load_graphifyignore.
(root: Path)
| 889 | |
| 890 | |
| 891 | def _load_graphifyinclude(root: Path) -> list[tuple[Path, str]]: |
| 892 | """Read .graphifyinclude allowlist patterns from root and ancestors. |
| 893 | |
| 894 | Include patterns opt matching hidden files/dirs into traversal. Sensitive |
| 895 | files and hard-skipped noise directories are still excluded later. |
| 896 | Uses the same VCS-root ceiling logic as _load_graphifyignore. |
| 897 | """ |
| 898 | root = root.resolve() |
| 899 | ceiling = _find_vcs_root(root) or root |
| 900 | |
| 901 | dirs: list[Path] = [] |
| 902 | current = root |
| 903 | while True: |
| 904 | dirs.append(current) |
| 905 | if current == ceiling: |
| 906 | break |
| 907 | current = current.parent |
| 908 | dirs.reverse() |
| 909 | |
| 910 | patterns: list[tuple[Path, str]] = [] |
| 911 | for d in dirs: |
| 912 | include_file = d / ".graphifyinclude" |
| 913 | if include_file.exists(): |
| 914 | for raw in include_file.read_text(encoding="utf-8", errors="ignore").splitlines(): |
| 915 | line = _parse_gitignore_line(raw) |
| 916 | if line: |
| 917 | patterns.append((d, line)) |
| 918 | return patterns |
| 919 | |
| 920 | |
| 921 | def _is_included(path: Path, root: Path, patterns: list[tuple[Path, str]]) -> bool: |
no test coverage detected