| 1 |
#!/bin/bash |
| 2 |
|
| 3 |
EXIT_CODE=0 |
| 4 |
for file in $(find . \( -iname '*.h' -o -iname '*.c' -o -iname '*.cc' \)); do |
| 5 |
fmt=$(clang-format $file) |
| 6 |
fmt_exit=$? |
| 7 |
if [[ $fmt_exit != 0 ]]; then |
| 8 |
EXIT_CODE="$fmt_exit" |
| 9 |
fi |
| 10 |
diff -u $file <(cat <<< "$fmt") |
| 11 |
done |
| 12 |
exit $EXIT_CODE |