summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorPatrick Georgi <pgeorgi@google.com>2019-02-27 22:02:04 +0100
committerPatrick Georgi <pgeorgi@google.com>2019-03-05 16:13:10 +0000
commit278529098918f2bdcf43526e584c102c78097b43 (patch)
treeff2b983925bdf0dbc11e8502a7ce9907be64fd91 /util
parent626ba097a2cd1c87800a2154420829b09803467e (diff)
downloadcoreboot-278529098918f2bdcf43526e584c102c78097b43.tar.xz
util/lint: Fix clang-format test and enable it by default
git diff needed to emit diffs without prefix (e.g. a/ and b/) for clang-format-diff to be able to work. Also require that the test succeeds, but note that it only runs on trees whitelisted in $(top)/.clang-format-scope. Change-Id: I7e9a32eb9281b5cb0b45506a206500fd1d315372 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/31654 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin Roth <martinroth@google.com>
Diffstat (limited to 'util')
-rwxr-xr-xutil/lint/lint-stable-022-clang-format (renamed from util/lint/lint-022-clang-format)6
1 files changed, 5 insertions, 1 deletions
diff --git a/util/lint/lint-022-clang-format b/util/lint/lint-stable-022-clang-format
index 932d9c0d50..bd662e472f 100755
--- a/util/lint/lint-022-clang-format
+++ b/util/lint/lint-stable-022-clang-format
@@ -30,5 +30,9 @@ if [ -z "$files_to_check" ]; then
fi
if [ $(clang-format $files_to_check | wc -l) -gt 0 ]; then
- git diff HEAD~..HEAD -- $files_to_check | clang-format-diff
+ if [ "$(git diff --no-prefix HEAD~..HEAD -- $files_to_check | clang-format-diff)" != "" ]; then
+ echo "Coding style mismatch. The following patch fixes it:"
+ git diff --no-prefix HEAD~..HEAD -- $files_to_check | clang-format-diff
+ exit 1
+ fi
fi