Skip to content

Commit 8c73ae7

Browse files
mayastor-borsurso
andcommitted
Merge #1906
1906: ci: filter git scissor line in commit lint hook r=tiagolobocastro a=urso Updates pre-commit hook to exclude Git's scissor line when running commitlint, preventing the hook from processing contents intended to be excluded from the final commit message. I have git configured to add a diff of all changes to my editor when writing the commit message. But unfortunately long lines and rust code tend to fail the commitlint. The filter will remove the diff before sending the commit message to commitlint. For example for this PR git did append the following to the message: ``` # # Co-authored-by: Steffen Siering <[email protected]>
2 parents bd1ab91 + 1ea4b16 commit 8c73ae7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ repos:
3535
name: Commit Lint
3636
description: Runs commitlint against the commit message.
3737
language: system
38-
entry: bash -c "npm install @commitlint/config-conventional @commitlint/cli; cat $1 | grep -v '^#' | npx commitlint"
38+
entry: bash -c "cat $1 | awk '/^# -+.*>8.*-+/{exit} 1' | grep -v '^#' | commitlint"
3939
args: [$1]
4040
stages: [commit-msg]
4141
- id: python-check

0 commit comments

Comments
 (0)