diff options
Diffstat (limited to 'build-aux/git-hooks/prepare-commit-msg')
| -rwxr-xr-x | build-aux/git-hooks/prepare-commit-msg | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/build-aux/git-hooks/prepare-commit-msg b/build-aux/git-hooks/prepare-commit-msg new file mode 100755 index 00000000000..3562a802234 --- /dev/null +++ b/build-aux/git-hooks/prepare-commit-msg | |||
| @@ -0,0 +1,45 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | # Check the format of GNU Emacs change log entries. | ||
| 3 | |||
| 4 | # Copyright 2019 Free Software Foundation, Inc. | ||
| 5 | |||
| 6 | # This file is part of GNU Emacs. | ||
| 7 | |||
| 8 | # GNU Emacs is free software: you can redistribute it and/or modify | ||
| 9 | # it under the terms of the GNU General Public License as published by | ||
| 10 | # the Free Software Foundation, either version 3 of the License, or | ||
| 11 | # (at your option) any later version. | ||
| 12 | |||
| 13 | # GNU Emacs is distributed in the hope that it will be useful, | ||
| 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 16 | # GNU General Public License for more details. | ||
| 17 | |||
| 18 | # You should have received a copy of the GNU General Public License | ||
| 19 | # along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. | ||
| 20 | |||
| 21 | COMMIT_MSG_FILE=$1 | ||
| 22 | COMMIT_SOURCE=$2 | ||
| 23 | SHA1=$3 | ||
| 24 | |||
| 25 | # Prefer gawk if available, as it handles NUL bytes properly. | ||
| 26 | if type gawk >/dev/null 2>&1; then | ||
| 27 | awk=gawk | ||
| 28 | else | ||
| 29 | awk=awk | ||
| 30 | fi | ||
| 31 | |||
| 32 | exec $awk ' | ||
| 33 | # Catch the case when someone ran git-commit with -s option, | ||
| 34 | # which automatically adds Signed-off-by. | ||
| 35 | /^Signed-off-by: / { | ||
| 36 | print "'\''Signed-off-by:'\'' in commit message" | ||
| 37 | status = 1 | ||
| 38 | } | ||
| 39 | END { | ||
| 40 | if (status != 0) { | ||
| 41 | print "Commit aborted; please see the file 'CONTRIBUTE'" | ||
| 42 | } | ||
| 43 | exit status | ||
| 44 | } | ||
| 45 | ' <"$COMMIT_MSG_FILE" | ||