summaryrefslogtreecommitdiffstats
path: root/ci/style-check.sh
diff options
context:
space:
mode:
Diffstat (limited to 'ci/style-check.sh')
-rwxr-xr-xci/style-check.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/ci/style-check.sh b/ci/style-check.sh
new file mode 100755
index 0000000..683bbcd
--- /dev/null
+++ b/ci/style-check.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+set -eu
+
+echo Evaluating changes:
+git diff -U0 "$TRAVIS_COMMIT_RANGE"
+echo
+
+diffs=$(git diff -U0 --no-color "$TRAVIS_COMMIT_RANGE" | "$CLANG_FORMAT_DIFF" -p1 -iregex '.*\.[ch]$')
+if [ "$diffs" != "" ]; then
+ echo ==== Style changes required ====
+ echo "$diffs"
+ exit 1
+fi
+