commit-msg 1001 B

123456789101112131415161718192021222324252627282930313233
  1. #!/bin/sh
  2. #
  3. # An example hook script to check the commit log message.
  4. # Called by "git commit" with one argument, the name of the file
  5. # that has the commit message. The hook should exit with non-zero
  6. # status after issuing an appropriate message if it wants to stop the
  7. # commit. The hook is allowed to edit the commit message file.
  8. echo "Running the AppFlowy commit-msg hook."
  9. # This example catches duplicate Signed-off-by lines.
  10. test "" = "$(grep '^Signed-off-by: ' "$1" |
  11. sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || {
  12. echo >&2 Duplicate Signed-off-by lines.
  13. exit 1
  14. }
  15. .githooks/gitlint \
  16. --msg-file=$1 \
  17. --subject-regex="^([bB]uild|[cC]hore|[cC]i|[dD]ocs|[fF]eat|[fF]eature|[fF]ix|[pP]erf|[rR]efactor|[rR]evert|[sS]tyle|[tT]est)(.*)?\s?:\s?.*" \
  18. --subject-maxlen=100 \
  19. --subject-minlen=10 \
  20. --body-regex=".*" \
  21. --body-maxlen=200 \
  22. --max-parents=1
  23. if [ $? -ne 0 ]
  24. then
  25. echo "Please fix your commit message to match AppFlowy coding standards"
  26. exit 1
  27. fi