File tree Expand file tree Collapse file tree 2 files changed +13
-11
lines changed Expand file tree Collapse file tree 2 files changed +13
-11
lines changed Original file line number Diff line number Diff line change @@ -285,18 +285,19 @@ you can add this to your configuration so commit messages are checked locally:
285
285
Into `.pre-commit-config.yaml` :
286
286
287
287
` ` ` yaml
288
-
289
- ---
288
+ default_stages: [commit]
290
289
repos:
291
- ---
292
- - repo: https://github.com/lumapps/commit-message-validator
293
- rev: master
294
- hooks:
295
- - id: commit-message-validator
296
- stages: [commit-msg]
297
- args: [--allow-temp]
290
+ - repo: https://github.com/lumapps/commit-message-validator
291
+ rev: master
292
+ hooks:
293
+ - id: commit-message-validator
294
+ stages: [commit-msg]
295
+ args: [--allow-temp]
298
296
` ` `
299
297
298
+ ` default_stages` tells which stage to install hooks that do not specify
299
+ a `stages` option.
300
+
300
301
Then run `pre-commit install --hook-type commit-msg` to install the
301
302
` commit-message-validator`
302
303
Original file line number Diff line number Diff line change 31
31
exit
32
32
fi
33
33
34
- MESSAGE=$( < " $1 " )
34
+ # removing comment lines from message
35
+ MESSAGE=$( sed ' /^#/d' " $1 " )
35
36
36
37
FIRST_WORD=${MESSAGE%% * }
37
38
if [[ " ${FIRST_WORD,,} " == merge ]]
44
45
# print message so you don't lose it in case of errors
45
46
# (in case you are not using `-m` option)
46
47
echo " Options: JIRA=$COMMIT_VALIDATOR_NO_JIRA , TEMP=$COMMIT_VALIDATOR_ALLOW_TEMP "
47
- printf " checking commit message:\n\n#BEGIN#\n%s\n#END#\n\n" " $( grep -v " # " <<< " $ MESSAGE" ) "
48
+ printf " checking commit message:\n\n#BEGIN#\n%s\n#END#\n\n" " $MESSAGE "
48
49
49
50
validate " $MESSAGE "
You can’t perform that action at this time.
0 commit comments