From 90679eb96909206b72f42a05baf1573a6ab21aea Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Wed, 27 Jan 2021 13:23:33 +0100 Subject: Add prepare-commit-msg hook depending on repo Enable it for the cilium/isovalent repos and linux for now. --- .config/git/hooks/with-signoff/prepare-commit-msg | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 .config/git/hooks/with-signoff/prepare-commit-msg (limited to '.config/git/hooks/with-signoff') diff --git a/.config/git/hooks/with-signoff/prepare-commit-msg b/.config/git/hooks/with-signoff/prepare-commit-msg new file mode 100755 index 0000000..fd76931 --- /dev/null +++ b/.config/git/hooks/with-signoff/prepare-commit-msg @@ -0,0 +1,18 @@ +#!/bin/sh + +NAME=$(git config user.name) +EMAIL=$(git config user.email) + +if [ -z "$NAME" ]; then + echo "empty git config user.name" + exit 1 +fi + +if [ -z "$EMAIL" ]; then + echo "empty git config user.email" + exit 1 +fi + +git interpret-trailers --if-exists doNothing --trailer \ + "Signed-off-by: $NAME <$EMAIL>" \ + --in-place "$1" -- cgit v1.2.3-54-g00ecf