Add .gitattributes to enforce LF line endings for shell scripts

This fixes issues when running scripts in WSL where CRLF line endings
cause 'No such file or directory' errors. Also add a fix_line_endings.sh
script for users who already have the wrong line endings.
This commit is contained in:
Claude
2025-11-13 20:07:57 +00:00
parent d288b2896f
commit 4c0b3429f0
2 changed files with 20 additions and 0 deletions
+2
View File
@@ -0,0 +1,2 @@
# Ensure shell scripts always use LF line endings
*.sh text eol=lf
+18
View File
@@ -0,0 +1,18 @@
#!/bin/bash
# Fix line endings for coverage scripts
echo "Fixing line endings for coverage scripts..."
# Convert CRLF to LF
dos2unix scripts/measure_coverage.sh 2>/dev/null || sed -i 's/\r$//' scripts/measure_coverage.sh
dos2unix scripts/generate_coverage_html.sh 2>/dev/null || sed -i 's/\r$//' scripts/generate_coverage_html.sh
# Ensure execute permissions
chmod +x scripts/measure_coverage.sh
chmod +x scripts/generate_coverage_html.sh
echo "Done! Line endings fixed and execute permissions set."
echo ""
echo "You can now run:"
echo " make coverage-report"
echo " make coverage-html"