Skip to content
Snippets Groups Projects
Commit 28d08192 authored by David Hendricks's avatar David Hendricks Committed by David Hendricks
Browse files

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: default avatarDavid Hendricks <david.hendricks@gmail.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/35295


Tested-by: default avatarbuild bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: default avatarNico Huber <nico.h@gmx.de>
parent 7f15de16
No related branches found
No related tags found
No related merge requests found
...@@ -28,6 +28,8 @@ unset GREP_OPTIONS ...@@ -28,6 +28,8 @@ unset GREP_OPTIONS
CHANGE_ID_AFTER="Bug|Depends-On|Issue|Test|Feature|Fixes|Fixed|Staging-ID" CHANGE_ID_AFTER="Bug|Depends-On|Issue|Test|Feature|Fixes|Fixed|Staging-ID"
MSG="$1" MSG="$1"
DEV_GUIDELINES_URL="https://www.flashrom.org/Development_Guidelines"
# Check for, and add if missing, a unique Change-Id # Check for, and add if missing, a unique Change-Id
# #
add_ChangeId() { add_ChangeId() {
...@@ -192,6 +194,14 @@ _gen_ChangeId() { ...@@ -192,6 +194,14 @@ _gen_ChangeId() {
git hash-object -t commit --stdin 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 for duplicate signoffs/acks
test_duplicate_signoffs_acks() { test_duplicate_signoffs_acks() {
test "" = "$(grep -i '^(Signed-off-by|Acked-by): ' "$MSG" | test "" = "$(grep -i '^(Signed-off-by|Acked-by): ' "$MSG" |
...@@ -202,6 +212,7 @@ test_duplicate_signoffs_acks() { ...@@ -202,6 +212,7 @@ test_duplicate_signoffs_acks() {
} }
main() { main() {
test_signoff
test_duplicate_signoffs_acks test_duplicate_signoffs_acks
add_ChangeId add_ChangeId
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment