summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Hendricks <dhendrix@chromium.org>2019-09-08 13:59:42 -0700
committerDavid Hendricks <david.hendricks@gmail.com>2019-10-14 05:23:01 +0000
commit28d081924ea6fca7a643ae273cb56cd11788adc5 (patch)
treef8b63bb8fc1337da5d76cb262cd4ce1728e2a7d4
parent7f15de164c2b6fcb82fb9634d5d43a2368338ac3 (diff)
downloadflashrom-28d081924ea6fca7a643ae273cb56cd11788adc5.tar.gz
flashrom-28d081924ea6fca7a643ae273cb56cd11788adc5.tar.bz2
flashrom-28d081924ea6fca7a643ae273cb56cd11788adc5.zip
util/git-hooks: Check for Signed-off-by line
Enforce the DCO. The logic comes from coreboot's commit-msg hook, and I've added a pointer to flashrom's development guidelines. Change-Id: Iea49a06c2d4824be073eff98c8aae1cbc5b145e4 Signed-off-by: David Hendricks <david.hendricks@gmail.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/35295 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de>
-rwxr-xr-xutil/git-hooks/commit-msg11
1 files changed, 11 insertions, 0 deletions
diff --git a/util/git-hooks/commit-msg b/util/git-hooks/commit-msg
index 346c08f3b..d43eb4529 100755
--- a/util/git-hooks/commit-msg
+++ b/util/git-hooks/commit-msg
@@ -28,6 +28,8 @@ unset GREP_OPTIONS
CHANGE_ID_AFTER="Bug|Depends-On|Issue|Test|Feature|Fixes|Fixed|Staging-ID"
MSG="$1"
+DEV_GUIDELINES_URL="https://www.flashrom.org/Development_Guidelines"
+
# Check for, and add if missing, a unique Change-Id
#
add_ChangeId() {
@@ -192,6 +194,14 @@ _gen_ChangeId() {
git hash-object -t commit --stdin
}
+test_signoff() {
+ if ! grep -qi '^[[:space:]]*\+Signed-off-by:' "$MSG"; then
+ printf "\nError: No Signed-off-by line in the commit message.\n"
+ printf "See: ${DEV_GUIDELINES_URL}\n"
+ exit 1
+ fi
+}
+
# Test for duplicate signoffs/acks
test_duplicate_signoffs_acks() {
test "" = "$(grep -i '^(Signed-off-by|Acked-by): ' "$MSG" |
@@ -202,6 +212,7 @@ test_duplicate_signoffs_acks() {
}
main() {
+ test_signoff
test_duplicate_signoffs_acks
add_ChangeId
}