Skip to content

Commit bd73bc7

Browse files
author
Daniel Kroening
committed
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.
1 parent 12c622d commit bd73bc7

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

.clang-format-ignore

Whitespace-only changes.

.travis.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ jobs:
1616
install:
1717
script: |
1818
clang-format-7 --version
19-
git-clang-format-7 --binary clang-format-7 "${TRAVIS_BRANCH}"
19+
# build a pathspec that excludes the files in .clang-format-ignore
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
2022
git diff > formatted.diff
2123
if [[ -s formatted.diff ]] ; then
2224
echo 'Formatting error! The following diff shows the required changes'

0 commit comments

Comments
 (0)