File tree 2 files changed +5
-2
lines changed
2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change 18
18
clang-format-7 --version
19
19
# build a pathspec that excludes the files in .clang-format-ignore
20
20
while read file ; do echo EXCLUDES+="':(top,exclude)$file' " ; done < .clang-format-ignore
21
- git-clang-format-7 --binary clang-format-7 "${TRAVIS_BRANCH}" -- $EXCLUDES
21
+ MERGE_BASE=$(git merge-base ${TRAVIS_COMMIT_RANGE%...*} ${TRAVIS_COMMIT_RANGE#*...})
22
+ echo "Checking for formatting errors introduced since $MERGE_BASE"
23
+ git-clang-format-7 --binary clang-format-7 $MERGE_BASE -- $EXCLUDES
22
24
git diff > formatted.diff
23
25
if [[ -s formatted.diff ]] ; then
24
26
echo 'Formatting error! The following diff shows the required changes'
Original file line number Diff line number Diff line change 12
12
git config remote.origin.fetch +refs/heads/$TRAVIS_BRANCH :refs/remotes/origin/$TRAVIS_BRANCH
13
13
git fetch --unshallow
14
14
git checkout $TMP_HEAD
15
- $script_folder /run_diff.sh CPPLINT origin/$TRAVIS_BRANCH # Check for errors compared to merge target
15
+ MERGE_BASE=$( git merge-base ${TRAVIS_COMMIT_RANGE% ...* } ${TRAVIS_COMMIT_RANGE#* ...} )
16
+ $script_folder /run_diff.sh CPPLINT $MERGE_BASE
16
17
fi
You can’t perform that action at this time.
0 commit comments