Files
FFmpeg/tools/check_commit_msg.sh
Jun Zhao 4394a36c6b tools/check_commit_msg: add commit message validation script
Add a shell script that validates commit messages against FFmpeg
conventions.  Based on the lint_commit_msg.py checker from mpv
(Kacper Michajłow, Timo Rothenpieler).

Supports three entry points: stdin (for CI pipelines), file
argument (for pre-commit commit-msg hook), and revision range
(for manual batch checking).

Checks enforced (errors block):
  - Subject matches "component[/module]: description" pattern
  - No conventional-commits style (feat:/fix:/chore:/refactor:)
  - Blank line between subject and body
  - No duplicate Signed-off-by from same person
  - No multiple subject-like lines in body (squash-mess detection)

Checks that only warn:
  - Subject line > 120 characters
  - Trailing whitespace on subject line
  - Subject should not end with a period
  - Prefix should not contain file extension (.c, .h, etc.)

Merge, Revert and Reapply subjects are exempted from format checks.

Usage:
  echo "avcodec/vvc: fix pred" | sh tools/check_commit_msg.sh
  sh tools/check_commit_msg.sh .git/COMMIT_EDITMSG
  sh tools/check_commit_msg.sh HEAD~5..HEAD

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2026-06-18 10:35:27 +00:00

8.7 KiB
Executable File