forked from vitessio/vitess
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add git hook to check for DCO signoff.
Signed-off-by: Anthony Yeh <[email protected]>
- Loading branch information
Showing
5 changed files
with
94 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
Developer Certificate of Origin | ||
Version 1.1 | ||
|
||
Copyright (C) 2004, 2006 The Linux Foundation and its contributors. | ||
1 Letterman Drive | ||
Suite D4700 | ||
San Francisco, CA, 94129 | ||
|
||
Everyone is permitted to copy and distribute verbatim copies of this | ||
license document, but changing it is not allowed. | ||
|
||
|
||
Developer's Certificate of Origin 1.1 | ||
|
||
By making a contribution to this project, I certify that: | ||
|
||
(a) The contribution was created in whole or in part by me and I | ||
have the right to submit it under the open source license | ||
indicated in the file; or | ||
|
||
(b) The contribution is based upon previous work that, to the best | ||
of my knowledge, is covered under an appropriate open source | ||
license and I have the right under that license to submit that | ||
work with modifications, whether created in whole or in part | ||
by me, under the same open source license (unless I am | ||
permitted to submit under a different license), as indicated | ||
in the file; or | ||
|
||
(c) The contribution was provided directly to me by some other | ||
person who certified (a), (b) or (c) and I have not modified | ||
it. | ||
|
||
(d) I understand and agree that this project and the contribution | ||
are public and that a record of the contribution (including all | ||
personal information I submit with it, including my sign-off) is | ||
maintained indefinitely and may be redistributed consistent with | ||
this project or the open source license(s) involved. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/bash | ||
|
||
# Runs any hooks in misc/git/commit-msg.*, and exits if any of them fail. | ||
set -e | ||
|
||
# This is necessary because the Emacs extensions don't set GIT_DIR. | ||
if [ -z "$GIT_DIR" ]; then | ||
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) | ||
GIT_DIR="${DIR}/.." | ||
fi | ||
|
||
# This is necessary because the Atom packages don't set GOPATH | ||
if [ -z "$GOPATH" ]; then | ||
GOPATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )/../../../../../.." && pwd ) | ||
export GOPATH | ||
fi | ||
|
||
for hook in $GIT_DIR/../misc/git/commit-msg.*; do | ||
$hook $@ | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/bin/bash | ||
|
||
# This script is run during "git commit" after the commit message was entered. | ||
# | ||
# If it does not find a Signed-off-by: line in this commit, | ||
# it prints a message about using the -s flag and a link | ||
# to an explanation of the DCO. | ||
|
||
msg_file="$1" | ||
|
||
git_email="$(git config --get user.email)" | ||
signoff="$(grep -E --max-count=1 "^Signed-off-by: " "$msg_file")" | ||
|
||
if [[ "$signoff" =~ \<(.*)\> ]]; then | ||
if [[ "${BASH_REMATCH[1]}" == "${git_email}" ]]; then | ||
# Everything checks out! | ||
exit 0 | ||
fi | ||
fi | ||
|
||
# No signoff found, or the email doesn't match. Print some instructions. | ||
echo | ||
echo "No 'Signed-off-by:' line was found, or the email didn't match" | ||
echo "the commit author (${git_email})." | ||
echo | ||
echo "This project uses a Developer Certificate of Origin" | ||
echo "instead of a Contributor License Agreement." | ||
echo "For more information, see: https://wiki.linuxfoundation.org/dco" | ||
echo | ||
echo "Please certify this contribution meets the requirements in the" | ||
echo "'DCO' file in the root of this repository by committing with" | ||
echo "the --signoff flag:" | ||
echo | ||
echo " git commit --signoff" | ||
exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters