diff --git a/linux_various/check_format.sh b/linux_various/check_format.sh index 3c460dd792..062c5a04ff 100755 --- a/linux_various/check_format.sh +++ b/linux_various/check_format.sh @@ -5,6 +5,18 @@ set -x ret=0 +if command -v clang-format-3.8 > /dev/null ; then + clang_format=clang-format-3.8 +else + if command -v clang-format > /dev/null ; then + clang_format=clang-format + else + return 2; + fi +fi + +$clang_format -version + # Doesn't work as travis only populate a single branch history #branch=`git rev-parse --abbrev-ref HEAD` @@ -64,7 +76,7 @@ files=`git diff --name-only --diff-filter=ACMRT $diff_range -- $PWD | \ # Check remaining files are clang-format compliant for f in $files do - clang-format -style=file -output-replacements-xml $f | grep "/dev/null + $clang_format -style=file -output-replacements-xml $f | grep "/dev/null if [ $? -ne 1 ] then echo "file $f did not match clang-format"