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.
This commit is contained in:
Jan Alexander Steffens (heftig) 2018-12-05 22:12:09 +01:00
parent 5b664cd00f
commit 4493ab0bb8
No known key found for this signature in database
GPG key ID: A5E9288C4FA415FA

View file

@ -46,12 +46,12 @@ gst indent:
- chmod +x gst-indent - chmod +x gst-indent
- find . -name '*.c' -exec ./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 git diff --color=always
echo 'style diverges, please run gst-indent first' echo 'style diverges, please run gst-indent first'
exit 1 exit 1
else
echo "Code is properly formatted"
fi fi
except: except:
variables: variables: