diff --git a/scripts/commit-msg.hook b/scripts/commit-msg.hook index 96692fdde..f34e693fd 100755 --- a/scripts/commit-msg.hook +++ b/scripts/commit-msg.hook @@ -476,7 +476,7 @@ validate_commit_message() { # Alert if the commit message appears to be written in Chinese. # This pattern matches any Chinese character (common CJK Unified Ideographs). - MISSPELLED_WORDS=$(echo "$FULL_COMMIT_MSG" | grep "[一-龥]") + MISSPELLED_WORDS=$(echo "$FULL_COMMIT_MSG" | LC_ALL=C grep "[一-龥]") if [ -n "$MISSPELLED_WORDS" ]; then add_warning 1 "Commit message appears to be written in Chinese: $MISSPELLED_WORDS" fi diff --git a/scripts/pre-commit.hook b/scripts/pre-commit.hook index 9f4dce1fd..bae4cb5ef 100755 --- a/scripts/pre-commit.hook +++ b/scripts/pre-commit.hook @@ -99,7 +99,7 @@ RETURN=0 # Disallow non-ASCII characters in workspace path workspace=$(git rev-parse --show-toplevel) -if echo "$workspace" | grep -q "[一-龥]"; then +if echo "$workspace" | LC_ALL=C grep -q "[一-龥]"; then throw "The workspace path '$workspace' contains non-ASCII characters." fi