Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lint-commit-messages: count multibyte characters intelligently #44

Merged
merged 1 commit into from
Jun 16, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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