From 8fa44ee11730ae73d38e10c6f291e3b1459495ae Mon Sep 17 00:00:00 2001 From: Oleg Hahm Date: Wed, 18 Feb 2015 16:12:17 +0100 Subject: [PATCH 1/2] dist/tools: check for whitespace errors --- dist/tools/whitespacecheck/check.sh | 37 +++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100755 dist/tools/whitespacecheck/check.sh diff --git a/dist/tools/whitespacecheck/check.sh b/dist/tools/whitespacecheck/check.sh new file mode 100755 index 0000000000..4b31f9e97f --- /dev/null +++ b/dist/tools/whitespacecheck/check.sh @@ -0,0 +1,37 @@ +#!/bin/sh + +# Copyright 2015 Oliver Hahm +# +# This file is subject to the terms and conditions of the GNU Lesser +# General Public License v2.1. See the file LICENSE in the top level +# directory for more details. + +# If no branch but an option is given, unset BRANCH. +# Otherwise, consume this parameter. +BRANCH="${1}" +if echo "${BRANCH}" | grep -q '^-'; then + if [ $(git rev-parse --abbrev-ref HEAD) != "master" ]; then + BRANCH="master" + else + BRANCH="" + fi +else + if [ -n "${BRANCH}" ]; then + shift 1 + fi +fi + + +# select files to check +if [ -z "${BRANCH}" ]; then + BRANCH=$(git rev-list HEAD | tail -n 1) +fi + +git diff --check $(git merge-base ${BRANCH} HEAD) > /dev/null +if [ $? -gt 0 ] +then + echo "ERROR: This change introduces new whitespace errors" + exit 1 +else + exit 0 +fi From 05fc8493d34f6993c476ed1953502e9225201337 Mon Sep 17 00:00:00 2001 From: Oleg Hahm Date: Wed, 18 Feb 2015 16:37:30 +0100 Subject: [PATCH 2/2] travis: added whitespace error to travis config --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 98721225ff..4fa9f0b95a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -44,6 +44,8 @@ script: - make -s -C ./examples/default info-concurrency - git rebase riot/master || git rebase --abort + - ./dist/tools/whitespacecheck/check.sh master || exit + - ./dist/tools/licenses/check.sh master --diff-filter=MR --error-exitcode=0 || exit - ./dist/tools/licenses/check.sh master --diff-filter=AC || exit