-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a pre-commit hook to check for signed-off commits (#1168)
Signed-off-by: Jan Schlicht <jan@d2iq.com>
- Loading branch information
Jan Schlicht
committed
Feb 21, 2020
1 parent
bbb21cd
commit 47853d3
Showing
2 changed files
with
30 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 |
---|---|---|
@@ -1,5 +1,19 @@ | ||
# Git hooks for KUDO. Install with | ||
# pre-commit install -t pre-commit -t commit-msg | ||
repos: | ||
- repo: git://github.com/golangci/golangci-lint | ||
rev: v1.22.0 | ||
- repo: local | ||
hooks: | ||
- id: golangci-lint | ||
name: golangci-lint | ||
description: Check that source code is linted | ||
entry: make lint | ||
language: system | ||
stages: [commit] | ||
- repo: local | ||
hooks: | ||
- id: signed-off-commits | ||
name: signed-off-commits | ||
description: Check that commit messages include a 'Signed-off-by' line | ||
entry: ./hack/check-commit-signed-off.sh | ||
language: script | ||
stages: [commit-msg] |
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,14 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
file="$1" | ||
|
||
signedoff_regex='^Signed-off-by: ' | ||
|
||
if [ "$(grep -c "$signedoff_regex" "$file")" != "1" ]; then | ||
printf >&2 "Signed-off-by line is missing.\n" | ||
exit 1 | ||
fi |