fix: allow PowerShell CRLF line endings

This commit is contained in:
2026-08-04 14:39:58 +02:00
parent be0e49fbc7
commit f4b9542c92
3 changed files with 68 additions and 0 deletions
+6
View File
@@ -9,6 +9,7 @@ printf '#!/bin/sh\nexit 0\n' > "$fixture_root/ok.sh"
printf '#!/bin/sh\r\nexit 0\r\n' > "$fixture_root/bad.sh"
printf 'services:\r\n app:\r\n image: example\r\n' > "$fixture_root/compose.yaml"
printf 'FROM scratch\r\n' > "$fixture_root/Dockerfile"
printf 'Write-Output "ok"\r\n' > "$fixture_root/valid.ps1"
set +e
output="$("$repo_root/scripts/verify-line-endings.sh" "$fixture_root" 2>&1)"
@@ -32,6 +33,11 @@ if grep -Fq 'ok.sh' <<< "$output"; then
exit 1
fi
if grep -Fq 'valid.ps1' <<< "$output"; then
echo "reported compliant CRLF PowerShell path: valid.ps1" >&2
exit 1
fi
printf '#!/bin/sh\nexit 0\n' > "$fixture_root/bad.sh"
printf 'services:\n app:\n image: example\n' > "$fixture_root/compose.yaml"
printf 'FROM scratch\n' > "$fixture_root/Dockerfile"
+4
View File
@@ -23,6 +23,10 @@ root="$(cd "$root" && pwd)"
offenders=()
while IFS= read -r -d '' file; do
case "$file" in
*.ps1) continue ;;
esac
if LC_ALL=C grep -Il $'\r' "$file" >/dev/null; then
offenders+=("${file#"$root"/}")
fi