Skip to content

Commit 9f06901

Browse files
Merge branch 'master' into markdownlint
2 parents f915f25 + 9605e51 commit 9f06901

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

README.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -285,18 +285,19 @@ you can add this to your configuration so commit messages are checked locally:
285285
Into `.pre-commit-config.yaml`:
286286

287287
```yaml
288-
289-
---
288+
default_stages: [commit]
290289
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]
298296
```
299297

298+
`default_stages` tells which stage to install hooks that do not specify
299+
a `stages` option.
300+
300301
Then run `pre-commit install --hook-type commit-msg` to install the
301302
`commit-message-validator`
302303

check_message.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ then
3131
exit
3232
fi
3333

34-
MESSAGE=$(<"$1")
34+
# removing comment lines from message
35+
MESSAGE=$(sed '/^#/d' "$1")
3536

3637
FIRST_WORD=${MESSAGE%% *}
3738
if [[ "${FIRST_WORD,,}" == merge ]]
@@ -44,6 +45,6 @@ fi
4445
# print message so you don't lose it in case of errors
4546
# (in case you are not using `-m` option)
4647
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"
4849

4950
validate "$MESSAGE"

0 commit comments

Comments
 (0)