[hooks PATCH] Don't allow @localhost email addresses in commit message

Daniel P. Berrangé berrange at redhat.com
Mon Jan 27 16:12:10 UTC 2020


Signed-off-by: Daniel P. Berrangé <berrange at redhat.com>
---
 update | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/update b/update
index 247b008..966fe22 100755
--- a/update
+++ b/update
@@ -264,6 +264,19 @@ if [ $check_diff = yes ]; then
 			fi
 		done
 	fi
+
+	allow_localhost_email=$(git config --bool hooks.allowlocalhostemail)
+	if [ "$allow_localhost_email" != "true" ]; then
+		for rev in `git log --format=%h $oldrev..$newrev`
+		do
+			git show $rev | grep '@localhost' >/dev/null 2>&1
+			if test $? != 0
+			then
+				echo "*** Update hook: @localhost email address is forbidden $rev" >&2
+				exit 1
+			fi
+		done
+	fi
 fi
 
 # --- Finished
-- 
2.24.1




More information about the libvir-list mailing list