aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorPetri Lehtinen <petri@digip.org>2019-10-17 11:41:16 +0300
committerPetri Lehtinen <petri@digip.org>2019-10-21 08:55:01 +0300
commit7c0297abe8f4fb4aafd642c3130628185dc78978 (patch)
treea2a248772ad821c6cde3c08fd1da33bebc53ebc4 /scripts
parent1a95a60f8093b709345ee6da8a954d1ebdfa5b7d (diff)
downloadjansson-7c0297abe8f4fb4aafd642c3130628185dc78978.zip
jansson-7c0297abe8f4fb4aafd642c3130628185dc78978.tar.gz
jansson-7c0297abe8f4fb4aafd642c3130628185dc78978.tar.bz2
Support running a specific clang-format version in CI
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/clang-format-ci7
1 files changed, 6 insertions, 1 deletions
diff --git a/scripts/clang-format-ci b/scripts/clang-format-ci
index 2051262..6854fc2 100755
--- a/scripts/clang-format-ci
+++ b/scripts/clang-format-ci
@@ -1,10 +1,15 @@
#!/bin/bash
+clangformat="clang-format"
+if [ -n "$1" ]; then
+ clangformat="clang-format-$1"
+fi
+
errors=0
paths=$(find . -type f -a '(' -name '*.c' -o -name '*.h' ')')
for path in $paths; do
in=$(cat $path)
- out=$(clang-format $path)
+ out=$($clangformat $path)
if [ "$in" != "$out" ]; then
diff -u -L $path -L "$path.formatted" $path - <<<$out