You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Write linter to check that commit messages have a new line before the body or no body at all.
reference: gist.github.com/agnivade/67b42d664ece2d4210c7
Fixes issue #19091.
# Distributed under the MIT software license, see the accompanying
4
+
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
5
+
#
6
+
# Linter to check that commit messages have a new line before the body
7
+
# or no body at all
8
+
9
+
export LC_ALL=C
10
+
11
+
EXIT_CODE=0
12
+
13
+
whilegetopts"?" opt;do
14
+
case$optin
15
+
?)
16
+
echo"Usage: $0 [N]"
17
+
echo" TRAVIS_COMMIT_RANGE='<commit range>' $0"
18
+
echo"$0 -?"
19
+
echo"Checks unmerged commits, the previous N commits, or a commit range."
20
+
echo"TRAVIS_COMMIT_RANGE='47ba2c3...ee50c9e' $0"
21
+
exit${EXIT_CODE}
22
+
;;
23
+
esac
24
+
done
25
+
26
+
if [ -z"${TRAVIS_COMMIT_RANGE}" ];then
27
+
if [ -n"$1" ];then
28
+
TRAVIS_COMMIT_RANGE="HEAD~$1...HEAD"
29
+
else
30
+
TRAVIS_COMMIT_RANGE="origin/master..HEAD"
31
+
fi
32
+
fi
33
+
34
+
while IFS= read -r commit_hash || [[ -n"$commit_hash" ]];do
35
+
n_line=0
36
+
while IFS= read -r line || [[ -n"$line" ]];do
37
+
n_line=$((n_line+1))
38
+
length=${#line}
39
+
if [ $n_line-eq 2 ] && [ $length-ne 0 ];then
40
+
echo"The subject line of commit hash ${commit_hash} is followed by a non-empty line. Subject lines should always be followed by a blank line."
0 commit comments