citemplate: add support for .indentignore file to indent job

See https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1465

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-ci/-/merge_requests/328>
This commit is contained in:
Tim-Philipp Müller 2020-08-05 00:32:17 +01:00
parent 91c85b7ca9
commit 1ab716b71d

View file

@ -358,7 +358,20 @@ gst indent:
script: script:
# man indent. grep RETURN VALUE, grab a beer on my behalf... # man indent. grep RETURN VALUE, grab a beer on my behalf...
- indent --version || true - 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 if git diff --quiet; then
echo "Code is properly formatted" echo "Code is properly formatted"