summary refs log tree commit diff
path: root/githooks/commit-msg
diff options
context:
space:
mode:
Diffstat (limited to 'githooks/commit-msg')
-rwxr-xr-xgithooks/commit-msg9
1 files changed, 9 insertions, 0 deletions
diff --git a/githooks/commit-msg b/githooks/commit-msg
new file mode 100755
index 0000000..d241f2b
--- /dev/null
+++ b/githooks/commit-msg
@@ -0,0 +1,9 @@
+#! /usr/bin/env bash
+set -euo pipefail
+change_id=$(head -c32 /dev/urandom | git hash-object --stdin)
+
+git interpret-trailers \
+    --if-exists doNothing \
+    --trailer "Change-Id:I$change_id" \
+    "$1" > "$1.tmp"
+mv "$1.tmp" "$1"