ci(static-checks): update line-endings script
This patch updates the line-endings script to filter for source and doc
files in a given diff before checking for CLRF.
Signed-off-by: Wing Li <wingers@google.com>
Change-Id: I4f7d504e121edd40c3ba835557fc103dea9a5d64
diff --git a/script/static-checks/static-checks-coding-style-line-endings.sh b/script/static-checks/static-checks-coding-style-line-endings.sh
index 77985e0..e5feeb5 100755
--- a/script/static-checks/static-checks-coding-style-line-endings.sh
+++ b/script/static-checks/static-checks-coding-style-line-endings.sh
@@ -15,8 +15,11 @@
if [[ "$2" == "patch" ]]; then
cd "$1"
+ shopt -s globstar
parent=$(git merge-base HEAD refs/remotes/origin/master | head -1)
- git diff ${parent}..HEAD --no-ext-diff --unified=0 --exit-code -a --no-prefix | awk '/^\+/ && /\r$/' &> "$LOG_FILE"
+ git diff $parent..HEAD --no-ext-diff --unified=0 --exit-code -a \
+ --no-prefix **/*.{S,c,h,i,dts,dtsi,rst,mk} Makefile | \
+ awk '/^\+/ && /\r$/' &> "$LOG_FILE"
else
# For all the source and doc files
# We only return the files that contain CRLF