clangify only the different files (#3122)

This commit is contained in:
Zach H 2018-02-28 13:20:53 -05:00 committed by GitHub
parent 941a06e107
commit 66958b5975
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,18 +1,22 @@
#!/bin/bash
# This script will run clang-format on all non-3rd-party C++/Header files.
# This script will run clang-format on all modified, non-3rd-party C++/Header files.
set -e
if hash clang-format 2>/dev/null; then
find . \( -name "*.cpp" -o -name "*.h" \) \
if hash clang-format 2>/dev/null && hash git 2>/dev/null; then
files_to_clean=($(git diff --name-only $(git merge-base origin/master HEAD)))
printf "%s\n" ${files_to_clean[@]} | \
xargs -I{} find '{}' \( -name "*.cpp" -o -name "*.h" \) \
-not -path "./cockatrice/src/qt-json/*" \
-not -path "./servatrice/src/smtp/*" \
-not -path "./common/sfmt/*" \
-not -path "./oracle/src/zip/*" \
-not -path "./build*/*" \
-exec clang-format -style=file -i {} \;
echo "Repository properly formatted"
echo "Successfully formatted following files:"
printf "%s\n" ${files_to_clean[@]}
else
echo "Please install clang-format to use this program"
echo "Please install clang-format and git to use this program"
fi