From 17f573520a82c5be6ccea8ede226abb6b2f3992d Mon Sep 17 00:00:00 2001
From: Christoph Groth <christoph.groth@cea.fr>
Date: Wed, 4 Jan 2017 14:45:01 +0100
Subject: [PATCH] CI: move whitespace check to external script

Without this measure, a failed check is no longer detected.  This seems
to be a bug in gitlab CI.
---
 .gitlab-ci.yml   | 3 +--
 check_whitespace | 8 ++++++++
 2 files changed, 9 insertions(+), 2 deletions(-)
 create mode 100755 check_whitespace

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 629b484c..6bc4541d 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -36,8 +36,7 @@ build package:
 
 check whitespace style:
   stage: build
-  script:
-    - "! for f in `git ls-files | grep -v \\.diff$`; do file $f | grep -q ' text' || continue; grep -q '[[:blank:]]$' $f && echo $f: trailing whitespace; tail -n1 $f | read -r _ || echo $f: no newline at end of file; tail -n1 $f | grep -q '^$' && echo $f: empty line at end of file; done | grep . >&2"
+  script: ./check_whitespace
   allow_failure: true
 
 check for dependencies installed:
diff --git a/check_whitespace b/check_whitespace
new file mode 100755
index 00000000..a0afee7b
--- /dev/null
+++ b/check_whitespace
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+! for f in $(git ls-files | grep -v \\.diff$); do
+    file $f | grep -q ' text' || continue
+    grep -q '[[:blank:]]$' $f && echo $f: trailing whitespace
+    tail -n1 $f | read -r _ || echo $f: no newline at end of file
+    tail -n1 $f | grep -q '^$' && echo $f: empty line at end of file
+done | grep . >&2
-- 
GitLab