File tree Expand file tree Collapse file tree 1 file changed +22
-10
lines changed Expand file tree Collapse file tree 1 file changed +22
-10
lines changed Original file line number Diff line number Diff line change 2
2
3
3
set -eu
4
4
5
- if [[ -v ZSH_NAME ]]; then
6
- setopt BASH_REMATCH
7
- setopt RE_MATCH_PCRE
8
- setopt KSH_ARRAYS
9
- fi
10
-
11
5
DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " > /dev/null 2>&1 && pwd ) "
12
- source $DIR /validator.sh
6
+ # shellcheck source=validator.sh
7
+ source " $DIR /validator.sh"
8
+
9
+
10
+ if [[ " $1 " == * MERGE_MSG ]]
11
+ then
12
+ # ignore merge message (merge with --no-ff without conflict)
13
+ exit
14
+ fi
13
15
14
16
MESSAGE=$( < " $1 " )
15
- echo " checking commit message: '${MESSAGE} '"
16
- validate " $MESSAGE "
17
17
18
- echo " Message succesfully checked"
18
+ FIRST_WORD=${MESSAGE%% * }
19
+ if [[ " ${FIRST_WORD,,} " == merge ]]
20
+ then
21
+ # ignore merge commits (merge after conflict resolution)
22
+ exit
23
+
24
+ fi
25
+
26
+ # print message so you don't lose it in case of errors
27
+ # (in case you are not using `-m` option)
28
+ printf " checking commit message:\n\n#BEGIN#\n%s\n#END#\n\n" " $( grep -v " #" <<< " $MESSAGE" ) "
29
+
30
+ COMMIT_VALIDATOR_ALLOW_TEMP=1 COMMIT_VALIDATOR_NO_JIRA=1 validate " $MESSAGE "
You can’t perform that action at this time.
0 commit comments