summaryrefslogtreecommitdiff
path: root/.config/git/hooks
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2021-01-27 13:23:33 +0100
committerTobias Klauser <tklauser@distanz.ch>2021-01-27 13:23:33 +0100
commit90679eb96909206b72f42a05baf1573a6ab21aea (patch)
tree88522ed29aca49424cbf18413095fb095cd2879d /.config/git/hooks
parent22234d360560bc9d9d587dfe46ab45da6201e4e0 (diff)
Add prepare-commit-msg hook depending on repo
Enable it for the cilium/isovalent repos and linux for now.
Diffstat (limited to '.config/git/hooks')
-rwxr-xr-x.config/git/hooks/with-signoff/prepare-commit-msg18
1 files changed, 18 insertions, 0 deletions
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"