diff options
author | edef <edef@unfathomable.blue> | 2022-06-18 16:24:44 +0000 |
---|---|---|
committer | edef <edef@unfathomable.blue> | 2022-06-19 09:41:30 +0000 |
commit | 4173cfc20899aea0b5e8f55fc348ca5df6c1629e (patch) | |
tree | e9db7f857ba06d75f1d894abf3ada43d498ea308 /githooks | |
parent | 3a225c1060beb3202f2d56df9d92923ec7da8f3b (diff) | |
download | unf-legacy-4173cfc20899aea0b5e8f55fc348ca5df6c1629e.tar.zst |
githooks: add Change-Id commit-msg hook
This adds a randomly generated Change-Id to every commit message that doesn't have one yet. Change-Id: Ic0d1bb74dc60633cd70550e0dde6b0b8340c89bd
Diffstat (limited to 'githooks')
-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" |