Skip to content
Snippets Groups Projects
Commit ba514777 authored by Ricardo Ribalda Delgado's avatar Ricardo Ribalda Delgado
Browse files

test-media-patchstyle: Support utf-8 subjects


If we grep the patch file it will contain some weird email encoding
when processing utf-8 strings. Eg:

Subject: [PATCH v2 1/1] =?utf-8?q?media=3A_v4l2-core=3A_Replace_the_check_fo?=
        =?utf-8?q?r_firmware_registered_I=C2=B2C_devices?=

Let git log do the hard work for us.

Signed-off-by: default avatarRicardo Ribalda <ribalda@chromium.org>
parent 16952cf5
No related branches found
No related tags found
1 merge request!246test-media-patchstyle: Support utf-8 subjects
Pipeline #1385315 failed
...@@ -200,23 +200,26 @@ check_checkpatch() { ...@@ -200,23 +200,26 @@ check_checkpatch() {
} }
check_subject() { check_subject() {
sha=$1
patch=$1 patch=$1
if grep -E -q "^Subject:.* Revert" "$patch"; then subject=$(git log -n 1 --format=%s "$sha")
if echo "$subject" | grep -E -q "^Revert"; then
return 0 return 0
fi fi
if python3 "$CI_DIR/lib/is-misc-only-patch.py"; then if python3 "$CI_DIR/lib/is-misc-only-patch.py"; then
return 0 return 0
elif python3 "$CI_DIR/lib/is-doc-only-patch.py"; then elif python3 "$CI_DIR/lib/is-doc-only-patch.py"; then
if ! grep -E -q "^Subject:.* (doc|docs|Documentation|media):" "$patch"; then if ! echo "$subject" | grep -E -q "^(doc|docs|Documentation|media):"; then
echo "ERROR: $patch: Missing 'media:' or 'doc:' prefix in Subject" >&2 && return 1 echo "ERROR: $patch: Missing 'media:' or 'doc:' prefix in Subject" >&2 && return 1
fi fi
elif python3 "$CI_DIR/lib/is-dt-bindings-only-patch.py"; then elif python3 "$CI_DIR/lib/is-dt-bindings-only-patch.py"; then
if ! grep -E -q "^Subject:.* (dt-bindings|media):" "$patch"; then if ! echo "$subject" | grep -E -q "^(dt-bindings|media):"; then
echo "ERROR: $patch: Missing 'media:' or 'dt-bindigs:' prefix in Subject" >&2 && return 1 echo "ERROR: $patch: Missing 'media:' or 'dt-bindigs:' prefix in Subject" >&2 && return 1
fi fi
elif ! grep -q "^Subject:.* media:" "$patch"; then elif ! echo "$subject" | grep -q "^media:"; then
echo "ERROR: $patch: Missing 'media:' prefix in Subject" >&2 && return 1 echo "ERROR: $patch: Missing 'media:' prefix in Subject" >&2 && return 1
fi fi
return 0 return 0
...@@ -250,7 +253,7 @@ if ! check_checkpatch "$PATCH"; then ...@@ -250,7 +253,7 @@ if ! check_checkpatch "$PATCH"; then
errno=1 errno=1
fi fi
if ! check_subject "$PATCH"; then if ! check_subject "$sha" "$PATCH"; then
errno=1 errno=1
fi fi
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment