From 1ab716b71d79f03f75c4fcea437fbb6ed5f85268 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Wed, 5 Aug 2020 00:32:17 +0100 Subject: [PATCH] citemplate: add support for .indentignore file to indent job See https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1465 Part-of: --- gitlab/ci_template.yml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/gitlab/ci_template.yml b/gitlab/ci_template.yml index 66264f2197..ad15cc62e8 100644 --- a/gitlab/ci_template.yml +++ b/gitlab/ci_template.yml @@ -358,7 +358,20 @@ gst indent: script: # man indent. grep RETURN VALUE, grab a beer on my behalf... - indent --version || true - - find . -name '*.c' -exec gst-indent {} + + - | + filter_cmd="cat" + if test -f ".indentignore"; then + filter_args="" + while read -r line; do + if test -n "$line"; then + filter_args="$filter_args -e $line" + fi + done < ".indentignore" + if test -n "$filter_args"; then + filter_cmd="grep -v $filter_args" + fi + fi + find . -name '*.c' | $filter_cmd | xargs gst-indent - | if git diff --quiet; then echo "Code is properly formatted"