run-clang-format.sh (577B)
1 #!/bin/bash 2 3 # Check if there are uncommitted changes (excluding rust backends) 4 if [ -n "$(git status --porcelain | egrep -v '(cubeb-coreaudio-rs|cubeb-pulse-rs)')" ]; then 5 echo "Not running clang-format -- commit changes and try again" 6 exit 0 7 fi 8 9 # Find and format all C/C++ files 10 find "$1/src" "$1/include" "$1/test" \ 11 -type f \( -name "*.cpp" -o -name "*.c" -o -name "*.h" \) \ 12 -not -path "*/subprojects/speex/*" \ 13 -not -path "*/src/cubeb-coreaudio-rs/*" \ 14 -not -path "*/src/cubeb-pulse-rs/*" \ 15 -print0 | xargs -0 "${2:-clang-format}" -Werror -i