-
-
Notifications
You must be signed in to change notification settings - Fork 114
Be sure your commit is Signed off by
Matthijs Kooijman edited this page Sep 24, 2015
·
4 revisions
In order for your contributed code to be included, it needs to be "Signed-off". More info about it are available in file CONTRIBUTING.md
Signing off is (and should be!) a manual operation and therefore easy to forget. You can tell git to help you checking if it's missing: it will warn you when adding a commit that is not signed off (or has duplicate signoff lines).
Create file REPO/.git/hooks/post-commit
and give it executable permissions. Paste the following code into it:
#!/bin/sh
if git log --format=%B -n 1 HEAD | grep '^Signed-off-by: ' | sort | uniq --repeated | grep . > /dev/null; then
echo >&2 ''
echo >&2 ' *******************************************'
echo >&2 ' * WARNING: Duplicate Signed-off-by lines! *'
echo >&2 ' * Use "git commit --amend to fix. *'
echo >&2 ' *******************************************'
echo >&2 ''
fi
if ! git log --format=%B -n 1 HEAD | grep '^Signed-off-by: '; then
echo >&2 ''
echo >&2 ' **********************************************************'
echo >&2 ' * WARNING: Missing Signed-off-by line, forgot --signoff? *'
echo >&2 ' * Use "git commit --amend --signoff" to fix. *'
echo >&2 ' **********************************************************'
echo >&2 ''
fi