git: cc038e71a30d - main - Tools/scripts: Add git-diff-ports.sh
Date: Sun, 28 Sep 2025 20:42:45 UTC
The branch main has been updated by yuri:
URL: https://cgit.FreeBSD.org/ports/commit/?id=cc038e71a30dbcb48b620c633fdcf91ccf16f861
commit cc038e71a30dbcb48b620c633fdcf91ccf16f861
Author: Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2025-09-28 03:50:50 +0000
Commit: Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2025-09-28 20:42:41 +0000
Tools/scripts: Add git-diff-ports.sh
This script returns the list of ports with uncommitted changes.
I was using it locally for a very long time and it proved to
be very useful.
---
Tools/scripts/git-diff-ports.sh | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/Tools/scripts/git-diff-ports.sh b/Tools/scripts/git-diff-ports.sh
new file mode 100755
index 000000000000..73ae0a8031a3
--- /dev/null
+++ b/Tools/scripts/git-diff-ports.sh
@@ -0,0 +1,35 @@
+#!/bin/sh
+#
+# MAINTAINER: yuri@FreeBSD.org
+
+set -e
+set -o pipefail
+
+export LC_ALL=C
+
+##
+## git-diff-ports.sh: returns the list of ports with uncommitted changes in the repository
+##
+
+# check that packaged dependencies are installed
+
+for dep in git; do
+ if ! which -s $dep; then
+ echo "error: the '$dep' dependency is missing"
+ if [ $dep == "git" ]; then
+ echo "... please install the 'git' package"
+ fi
+ exit 1
+ fi
+done
+
+
+# MAIN
+
+git diff HEAD "$@" |
+ grep "^diff " |
+ grep -v Mk/ |
+ grep -v Tools/ |
+ sed -E 's|diff --git a/||; s| .*||; s|([^/]+/[^/]+).*|\1|' |
+ sort |
+ uniq