diff options
Diffstat (limited to 'contrib/conf/commit-msg')
-rwxr-xr-x | contrib/conf/commit-msg | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/contrib/conf/commit-msg b/contrib/conf/commit-msg new file mode 100755 index 000000000..e57333c00 --- /dev/null +++ b/contrib/conf/commit-msg | |||
@@ -0,0 +1,34 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | # use as .git/hooks/commit-msg | ||
4 | |||
5 | COMMIT_MSG_FILE=$1 | ||
6 | |||
7 | exec 1>&2 | ||
8 | |||
9 | RET=0 | ||
10 | changed=$(git diff --cached --name-only) | ||
11 | |||
12 | for f in $changed; | ||
13 | do | ||
14 | # Only headers in include | ||
15 | if echo $f | grep \src\/include\/.\*\.h\$ > /dev/null | ||
16 | then | ||
17 | RET=1 | ||
18 | # Check if it has a NEWS line | ||
19 | if cat $COMMIT_MSG_FILE | grep -i "^NEWS:\s[-,a-zA-Z][a-zA-Z]*" > /dev/null | ||
20 | then | ||
21 | RET=0 | ||
22 | break | ||
23 | fi | ||
24 | fi | ||
25 | done | ||
26 | |||
27 | # If no NEWS line found, abort | ||
28 | if [ $RET = 1 ]; | ||
29 | then | ||
30 | echo "Your commit includes staged changes that indicate an API change which requires a NEWS line." | ||
31 | else | ||
32 | echo "Your commit does not include API changes" | ||
33 | fi | ||
34 | exit 0 | ||