enable .clang-format-ignore

We do have files that are imported as a whole, and clang-formatting them is
a distraction.  The requirement to add // clang-format-off to external files
makes imports via scripts more difficult.

This tweaks the build script to exclude files given in .clang-format-ignore
from git-clang-format.  The same naming convention is used by other
projects.
This commit is contained in:
Daniel Kroening 2019-01-27 14:17:00 +00:00
parent 12c622dfaa
commit 8edc5049cd
2 changed files with 3 additions and 1 deletions

0
.clang-format-ignore Normal file
View File

View File

@ -16,7 +16,9 @@ jobs:
install:
script: |
clang-format-7 --version
git-clang-format-7 --binary clang-format-7 "${TRAVIS_BRANCH}"
# build a pathspec that excludes the files in .clang-format-ignore
while read file ; do echo EXCLUDES+="':(top,exclude)$file' " ; done < .clang-format-ignore
git-clang-format-7 --binary clang-format-7 "${TRAVIS_BRANCH}" -- $EXCLUDES
git diff > formatted.diff
if [[ -s formatted.diff ]] ; then
echo 'Formatting error! The following diff shows the required changes'