From: Sasha Levin Date: Fri, 20 Dec 2024 14:37:25 +0000 (-0500) Subject: dropped_commits.sh: fix awk compatibility X-Git-Tag: v6.1.122~48 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1de1f9b8732dcc9378fe0397b58375671b6fc3ff;p=thirdparty%2Fkernel%2Fstable-queue.git dropped_commits.sh: fix awk compatibility Signed-off-by: Sasha Levin --- diff --git a/scripts/dropped_commits.sh b/scripts/dropped_commits.sh index 9b9e7f8a23f..777c5e05649 100755 --- a/scripts/dropped_commits.sh +++ b/scripts/dropped_commits.sh @@ -8,16 +8,16 @@ extract_sha1() { local content="$1" # Skip everything until the first blank line (end of commit metadata) # Then look for first 40-character hex string - awk ' + echo "$content" | awk ' BEGIN { found_blank = 0 } /^$/ { found_blank = 1; next } found_blank == 1 { - if (match($0, /[0-9a-f]{40}/, m)) { - print m[0] + if (match($0, /[0-9a-f]{40}/)) { + print substr($0, RSTART, RLENGTH) exit } } - ' <<< "$content" || echo "NO_SHA" + ' || echo "NO_SHA" } # Function to check if a file was moved rather than deleted