check-line-endings.sh 337 B

1234567891011121314
  1. #!/bin/sh
  2. if ! [ -z "$1" ]; then
  3. cd "$1"
  4. fi
  5. echo "Checking for Windows line endings in `pwd`"
  6. if git ls-tree --name-only -r HEAD | xargs file -N | grep CRLF; then
  7. echo "Some files have CRLF (Windows-style) line endings. Please convert to LF (Unix-style). git can be configured to do this automatically."
  8. exit 1
  9. fi
  10. exit 0