From 4493ab0bb8ddfa52ed5b54137cc28013a6e11888 Mon Sep 17 00:00:00 2001 From: "Jan Alexander Steffens (heftig)" Date: Wed, 5 Dec 2018 22:12:09 +0100 Subject: [PATCH] ci_template: Use git diff --quiet for checking for changes Checking the exit code of git diff --quiet is preferred over looking whether git diff produces any output. --- gitlab/ci_template.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gitlab/ci_template.yml b/gitlab/ci_template.yml index 380343ff30..7052006c1b 100644 --- a/gitlab/ci_template.yml +++ b/gitlab/ci_template.yml @@ -46,12 +46,12 @@ gst indent: - chmod +x gst-indent - find . -name '*.c' -exec ./gst-indent {} + - | - if [[ $(git diff) ]]; then + if git diff --quiet; then + echo "Code is properly formatted" + else git diff --color=always echo 'style diverges, please run gst-indent first' exit 1 - else - echo "Code is properly formatted" fi except: variables: