clangify only the different files (#3122)
This commit is contained in:
parent
941a06e107
commit
66958b5975
1 changed files with 9 additions and 5 deletions
14
clangify.sh
14
clangify.sh
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue