check-format-commit.sh: make awk patterns more robust for MacOS and certain flavors of Linux

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/25666)
This commit is contained in:
Dr. David von Oheimb 2024-10-10 22:13:42 +02:00
parent 06aa41a5f5
commit 380ea5974c
1 changed files with 5 additions and 5 deletions

View File

@ -72,14 +72,14 @@ fi
touch $TEMPDIR/ranges.txt touch $TEMPDIR/ranges.txt
git diff -U0 $COMMIT_RANGE | awk ' git diff -U0 $COMMIT_RANGE | awk '
BEGIN {myfile=""} BEGIN {myfile=""}
/+{3}/ { /^\+\+\+/ {
gsub(/b\//,"",$2); sub(/^b./,"",$2);
myfile=$2 myfile=$2
} }
/@@/ { /^@@/ {
gsub(/+/,"",$3); sub(/^\+/,"",$3);
printf myfile " " $3 "\n" printf myfile " " $3 "\n"
}' >> $TEMPDIR/ranges.txt || true }' > $TEMPDIR/ranges.txt || true
# filter in anything that matches on a filter regex # filter in anything that matches on a filter regex
for i in ${FILE_ALLOWLIST[@]} for i in ${FILE_ALLOWLIST[@]}