git: f4036f00d461 - main - Tools/scripts: Use awk in git-diff-ports.sh

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Tue, 30 Sep 2025 06:20:54 UTC
The branch main has been updated by yuri:

URL: https://cgit.FreeBSD.org/ports/commit/?id=f4036f00d4613e5f578ed603b1b539a6692358c8

commit f4036f00d4613e5f578ed603b1b539a6692358c8
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2025-09-30 06:15:29 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2025-09-30 06:15:29 +0000

    Tools/scripts: Use awk in git-diff-ports.sh
    
    Submitted by:   bapt@FreeBSD.org (initial version)
    Differential Revision:  https://reviews.freebsd.org/D52779
---
 Tools/scripts/git-diff-ports.sh | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/Tools/scripts/git-diff-ports.sh b/Tools/scripts/git-diff-ports.sh
index e519ca70b216..f13ed0779064 100755
--- a/Tools/scripts/git-diff-ports.sh
+++ b/Tools/scripts/git-diff-ports.sh
@@ -16,7 +16,7 @@ export LC_ALL=C
 for dep in git; do
 	if ! which -s $dep; then
 		echo "error: the '$dep' dependency is missing"
-		if [ $dep == "git" ]; then
+		if [ $dep = "git" ]; then
 			echo "... please install the 'git' package"
 		fi
 		exit 1
@@ -27,10 +27,5 @@ done
 # MAIN
 
 git diff HEAD "$@" |
-	grep "^diff " |
-	grep -v Mk/ |
-	grep -v Tools/ |
-	sed -E 's|diff --git a/||; s| .*||; s|([^/]+/[^/]+).*|\1|' |
-	grep -v '/Makefile$' |
-	sort |
-	uniq
+	awk -F / '/^diff/ && $2 !~ /[[:upper:]]/ && $3 !~ /^Makefile/ { print $2 "/" $3 }' |
+	sort -u