Commit cc51c25
committed
fix(config)!: Correct handling of global_exclude_patterns and directory ignores
Resolves several issues related to the integration and behavior of
`global_exclude_patterns` from `pyproject.toml` configuration and
general directory exclusion logic.
Key fixes and improvements:
1. **Parameter Passing (`main.py`):** Ensured `config_global_excludes`
is correctly passed from `flatten_command` to `flatten_code_logic`.
2. **Directory Exclusion Logic (`ignore_handler.py`):**
- Modified `is_path_ignored` to correctly exclude files *within*
a directory matched by a directory pattern (e.g., "docs/"). This
was achieved by checking if any parent path of a file matches such
a directory exclusion pattern.
- Applied this improved parent-checking logic to both config-based
and CLI-based directory exclusion patterns.
3. **Test Suite Corrections:**
- Updated `CliRunner` tests in `test_main.py` to correctly set up
the `pyproject.toml` within the isolated filesystem used by tests,
ensuring config is loaded as expected during CLI command invocations.
- Refined assertions in integration tests to accurately check for the
presence/absence of specific file headers rather than just string
content, avoiding false positives from config file content itself.
- Updated function call signatures in existing tests to accommodate
the new `config_global_excludes` parameter.
- Refreshed test snapshots for `tree_generator` to align with the
corrected ignore/negation logic.
All 101 tests now pass, confirming that `global_exclude_patterns` from
configuration work as intended for both `tree` and `flatten` commands,
and directory exclusion patterns are applied robustly.
BREAKING CHANGE: The behavior of directory exclusion patterns (e.g., "docs/")
is now more comprehensive, ensuring files within such excluded directories are
also ignored. This might alter the output of `tree` and `flatten` for users
relying on the previous, less strict behavior.1 parent 4d6849f commit cc51c25
4 files changed
Lines changed: 266 additions & 223 deletions
0 commit comments