File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -105,7 +105,16 @@ matrix:
105
105
popd;
106
106
- astyle --version
107
107
script :
108
- - find -regex '.*\.\(h\|c\|hpp\|cpp\)' -type f | fgrep -v -f .astyleignore | xargs -n 100 -I {} bash -c "astyle -n --options=.astylerc \"{}\"" > astyle.out;
108
+ # only changed files to be checked for astyle
109
+ - COMMIT_RANGE=${TRAVIS_COMMIT_RANGE/.../..}
110
+ - if [! git diff --quiet "$COMMIT_RANGE" -- ]
111
+ then
112
+ COMMIT_CONTENT=`git diff-tree --no-commit-id --name-only -r $TRAVIS_COMMIT`
113
+ else
114
+ COMMIT_CONTENT=`git diff --name-only $COMMIT_RANGE`
115
+ fi
116
+ - echo $COMMIT_CONTENT
117
+ - find -regex '.*\.\(h\|c\|hpp\|cpp\)' -type f | fgrep -v -f .astyleignore | $COMMIT_CONTENT | xargs -n 100 -I {} bash -c "astyle -n --options=.astylerc \"{}\"" > astyle.out;
109
118
if [ $(cat astyle.out | grep Formatted | wc -l) -ne 0 ]; then
110
119
git --no-pager diff;
111
120
echo "Please fix style issues as shown above";
You can’t perform that action at this time.
0 commit comments