diff options
-rwxr-xr-x | githooks/commit-msg | 9 |
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" |