File 0352-scripts-pre-push-Reject-fixup-commits.patch of Package erlang
From e380b418a4a3e12f3cc3e0662ca5ae27f4cae483 Mon Sep 17 00:00:00 2001
From: Sverker Eriksson <sverker@erlang.org>
Date: Wed, 7 Jun 2023 22:28:54 +0200
Subject: [PATCH 2/2] scripts/pre-push: Reject fixup! commits
---
scripts/pre-push | 27 ++++++++++++++++++++++++++-
1 file changed, 26 insertions(+), 1 deletion(-)
diff --git a/scripts/pre-push b/scripts/pre-push
index a37e26d9ee..f1a6de50fd 100755
--- a/scripts/pre-push
+++ b/scripts/pre-push
@@ -61,11 +61,17 @@ error_color() {
printf '%b' "\033[31m"
}
+notice_color() {
+ printf '%b' "\033[36m"
+}
+
reset_color() {
printf '%b' "\033[0m"
}
-if [ "$url" = 'https://github.com/erlang/otp.git' -o "$url" = 'git@github.com:erlang/otp.git' -o "$url" = 'git@github.com:erlang/otp' ]
+if [ "$url" = 'https://github.com/erlang/otp.git' -o\
+ "$url" = 'git@github.com:erlang/otp.git' -o\
+ "$url" = 'git@github.com:erlang/otp' ]
then
if [ $remote = "$url" ]; then
error_color
@@ -223,6 +229,25 @@ then
reset_color
exit 1
fi
+
+ # Check for fixup! commits
+ FIXUPS=`git log --format='format:%h: %s' $remote_sha..$local_sha | grep -E '^\w+: fixup!'`
+ if [ -n "$FIXUPS" ]
+ then
+ error_color
+ echo "$0 says:"
+ echo "***"
+ echo "*** \"fixup!\" commit found: NOT ALLOWED!!!!"
+ echo "***"
+ notice_color
+ cat <<EOF
+$FIXUPS
+
+EOF
+ reset_color
+ exit 1
+ fi
+
;;
refs/tags/OTP-*)
tag=${remote_ref#refs/tags/}
--
2.35.3