feat: Add --max-depth option and safe symlink handling (v1.2.0)

## Neue Features

- **--max-depth N**: Begrenzt Rekursionstiefe auf N Ebenen (erfordert -r)
  - Nützlich für sehr tiefe Verzeichnisbäume (z.B. node_modules)
  - Verhindert unnötige Traversierung tiefer Strukturen

- **Explizites Symlink-Handling**:
  - Standard: Symlinks werden komplett übersprungen (sicher)
  - Mit --special: Nur Symlink-Namen werden bereinigt, Ziel bleibt unangetastet
  - follow_links(false) explizit gesetzt zur Vermeidung von Endlosschleifen
  - Verhindert unbeabsichtigte Änderungen außerhalb des Zielverzeichnisses

- **Verbose Symlink-Logging**: Zeigt mit -v welche Symlinks übersprungen werden

## Tests

- 5 neue Integration-Tests hinzugefügt:
  - test_max_depth_option
  - test_max_depth_requires_recursive
  - test_symlinks_default_behavior (Unix only)
  - test_symlinks_with_special_flag (Unix only)
  - test_symlinks_not_followed (Unix only)

- Alle 30 Tests bestehen (25 bestehende + 5 neue)

## Dokumentation

- README.md: Neue Beispiele und "Symlink Behavior" Sektion
- CHANGELOG.md: v1.2.0 Eintrag mit allen Änderungen
- man/ntu.1: --max-depth Option und SYMLINK BEHAVIOR Sektion
- CLAUDE.md: Aktualisierte Code-Architektur Dokumentation

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Dieter Schlüter 2026-02-12 13:39:41 +01:00
commit b84dd70f80
8 changed files with 228 additions and 7 deletions

View file

@ -5,6 +5,26 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [1.2.0] - 2025-02-12
### Added
- **`--max-depth N` option**: Limit recursion depth to N levels (requires `-r/--recursive`)
- **Explicit symlink handling**: Symlinks are no longer followed (`follow_links(false)`)
- Default: Symlinks are completely skipped (not renamed, not followed)
- With `--special`: Only the symlink name is sanitized, target remains unchanged
- Prevents infinite loops from circular symlinks
- Prevents unintended changes outside target directory
- **Verbose symlink logging**: Shows which symlinks are skipped when using `-v`
### Changed
- `WalkDir` now explicitly uses `follow_links(false)` for safety
- Improved verbose logging to indicate when max-depth is active
### Technical
- Added 5 new integration tests for max-depth and symlink behavior
- All tests passing (30 total: 25 existing + 5 new)
- Unix-specific symlink tests use `#[cfg(unix)]` attribute
## [1.1.0] - 2025-02-10
### Added