Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
update | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/update b/update
index 247b008..7f26035 100755
--- a/update
+++ b/update
@@ -41,6 +41,10 @@
# When this boolean is true, you may not push a merge commit to BRANCH_NAME.
# By default, you may.
#
+# hooks.allowlocalhostemail
+# When this boolean is true, commit message email addresses are
+# allowed to refer to @localhost
+#
# ---------------------------------------------------------------------
# Allow people to change server-side git config in very specific ways.
# To enable this, on the server, you must do something like the following,
@@ -264,6 +268,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 -E '<.*(a)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