Skip to content

Commit 52cc779

Browse files
committed
ci: add script to check line endings
1 parent 5a47799 commit 52cc779

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

.gitlab-ci.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,14 @@ run_autotests_armel:
343343
- ./run_tests.py -o $DIST_DIR/bin/openocd -s $DIST_DIR/share/openocd/scripts -a $PWD/test_apps -d 4 -l ./debug_backend_tests.log
344344
- popd
345345

346+
style_check:
347+
stage: test
348+
image: $CI_DOCKER_REGISTRY/esp32-toolchain
349+
tags:
350+
- build
351+
script:
352+
- tools/check-line-endings.sh $PWD
353+
346354
push_master_to_github:
347355
stage: deploy
348356
image: $CI_DOCKER_REGISTRY/esp32-ci-env

tools/check-line-endings.sh

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

0 commit comments

Comments
 (0)