File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change 1+ language : cpp
2+ matrix :
3+ include :
4+ - os : linux
5+ dist : xenial
6+ env : TOOL=clang-format
7+ addons :
8+ apt :
9+ sources :
10+ - llvm-toolchain-xenial-7
11+ packages :
12+ - clang-format-7
13+ compiler : clang
14+ script :
15+ - if [[ $TOOL == "clang-format" ]] && [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
16+ cd $TRAVIS_BUILD_DIR;
17+ BASE_COMMIT=$(git rev-parse $TRAVIS_BRANCH);
18+ COMMIT_FILES=$(git diff --name-only $BASE_COMMIT | grep -i -v LinkDef);
19+ RESULT_OUTPUT="$(git-clang-format-7 --commit $BASE_COMMIT --diff --binary `which clang-format-7` $COMMIT_FILES)";
20+ if [ "$RESULT_OUTPUT" == "no modified files to format" ] || [ "$RESULT_OUTPUT" == "clang-format did not modify any files" ] ; then
21+ exit 0;
22+ else
23+ echo "$RESULT_OUTPUT";
24+ exit 1;
25+ fi
26+ fi
You can’t perform that action at this time.
0 commit comments