From f4e631ffdb9d76e1cbd8db108c7028fd7df3e8c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cenk=20G=C3=BCndo=C4=9Fan?= Date: Tue, 4 Aug 2020 13:11:05 +0200 Subject: [PATCH] tools: whitespacecheck: use ignore file to easily add expressions --- dist/tools/whitespacecheck/check.sh | 6 +++--- dist/tools/whitespacecheck/ignore_list.txt | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 dist/tools/whitespacecheck/ignore_list.txt diff --git a/dist/tools/whitespacecheck/check.sh b/dist/tools/whitespacecheck/check.sh index 097330ed27..dfc558efc1 100755 --- a/dist/tools/whitespacecheck/check.sh +++ b/dist/tools/whitespacecheck/check.sh @@ -6,7 +6,7 @@ # General Public License v2.1. See the file LICENSE in the top level # directory for more details. -NOVENDOR=":!*/vendor/*" +IGNORE=`awk '{ printf ":!%s ", $0 }' $(dirname "$0")/ignore_list.txt` # If no branch but an option is given, unset BRANCH. # Otherwise, consume this parameter. @@ -30,14 +30,14 @@ if [ -z "${BRANCH}" ]; then fi git -c core.whitespace="tab-in-indent,tabwidth=4" \ - diff --check $(git merge-base ${BRANCH} HEAD) -- *.[ch] ${NOVENDOR} + diff --check $(git merge-base ${BRANCH} HEAD) -- *.[ch] ${IGNORE} RESULT=$? # Git regards any trailing white space except `\n` as an error so `\r` is # checked here, too git -c core.whitespace="trailing-space" \ - diff --check $(git merge-base ${BRANCH} HEAD) -- . ${NOVENDOR} + diff --check $(git merge-base ${BRANCH} HEAD) -- . ${IGNORE} if [ $? -ne 0 ] || [ $RESULT -ne 0 ] then echo "ERROR: This change introduces new whitespace errors" diff --git a/dist/tools/whitespacecheck/ignore_list.txt b/dist/tools/whitespacecheck/ignore_list.txt new file mode 100644 index 0000000000..aa07e0b32a --- /dev/null +++ b/dist/tools/whitespacecheck/ignore_list.txt @@ -0,0 +1 @@ +*/vendor/*