Skip to content
Snippets Groups Projects
Unverified Commit 8078dec3 authored by Richard van der Hoff's avatar Richard van der Hoff Committed by GitHub
Browse files

Fix exit code for `check_line_terminators.sh` (#7970)

If there are *no* files with CRLF line endings, then the xargs exits with a
non-zero exit code (as expected), but then, since that is the last thing to
happen in the script, the script as a whole exits non-zero, making the whole
thing fail.

using `if/then/fi` instead of `&& (...)` means that the script exits with a
zero exit code.
parent 3857de21
No related branches found
No related tags found
No related merge requests found
Add a script to detect source code files using non-unix line terminators.
\ No newline at end of file
...@@ -28,4 +28,7 @@ ...@@ -28,4 +28,7 @@
cd `dirname $0`/.. cd `dirname $0`/..
# Find and print files with non-unix line terminators # Find and print files with non-unix line terminators
find . -path './.git/*' -prune -o -type f -print0 | xargs -0 grep -I -l $'\r$' && ( echo 'found files with CRLF line endings'; exit 1 ) if find . -path './.git/*' -prune -o -type f -print0 | xargs -0 grep -I -l $'\r$'; then
echo -e '\e[31mERROR: found files with CRLF line endings. See above.\e[39m'
exit 1
fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment