$ErrorActionPreference = "Stop" param( [Parameter(Mandatory = $false)] [string]$RepoPath = "." ) $invalidCharPattern = '[<>:""/|?*]' $reserved = '^(CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])(\..*)?$' $repoAbs = Resolve-Path $RepoPath Push-Location $repoAbs try { $paths = git ls-tree -r --name-only HEAD if (-not $paths) { Write-Output "Keine Dateien im Git-Tree gefunden." exit 0 } $issues = @() foreach ($p in $paths) { $parts = $p -split '/' foreach ($part in $parts) { if ($part -match $invalidCharPattern) { $issues += "INVALID_CHAR: $p" break } if ($part -match $reserved) { $issues += "RESERVED_NAME: $p" break } if ($part.EndsWith(".") -or $part.EndsWith(" ")) { $issues += "TRAILING_DOT_SPACE: $p" break } } if ($p.Length -gt 245) { $issues += "POTENTIAL_LONG_PATH($($p.Length)): $p" } } if ($issues.Count -eq 0) { Write-Output "Keine offensichtlichen Windows-Pfadprobleme im aktuellen Commit gefunden." exit 0 } $issues | Sort-Object -Unique | ForEach-Object { Write-Output $_ } exit 2 } finally { Pop-Location }