Skip to content

Commit

Permalink
Merge pull request #44 from sanctuary-js/davidchambers/encoding
Browse files Browse the repository at this point in the history
lint-commit-messages: count multibyte characters intelligently
  • Loading branch information
davidchambers authored Jun 16, 2021
2 parents fad28e2 + 862bf3a commit b2f74c4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions bin/lint-commit-messages
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ branch_name() {
# Find all commits to be merged, and assert that none of them exceeds
# the character limit. Ignore merge commits to accommodate Travis, which
# makes a merge commit (with a long message) in order to test the result
# of merging the pull request.
if git log --no-merges --format=%s "$default_branch.." | grep ".\\{$max_length\\}." ; then
# of merging the pull request. Specify LC_CTYPE=C.UTF-8, if available,
# so grep will count multibyte characters intelligently.
if git log --no-merges --format=%s "$default_branch.." | LC_CTYPE="$(locale -a | grep '^C[.]UTF-8$' || echo "$LC_CTYPE")" grep ".\\{$max_length\\}." ; then
fail "At least one commit summary exceeds $max_length-character limit"
exit 1
fi
Expand Down

0 comments on commit b2f74c4

Please sign in to comment.