Skip to content

Commit a1c5a5e

Browse files
committed
Disallow non-ASCII characters in workspace path
The Git hook ensures that only ASCII paths are used, helping avoid potential issues with tools that may not handle non-ASCII characters well. Change-Id: I02b29e00fd297b15c878f4bdb41c8fa47483f546
1 parent 391c1a4 commit a1c5a5e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

scripts/pre-commit.hook

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@ CPPCHECK_OPTS+=" --force $(cppcheck_suppressions) $(cppcheck_build_unmatched)"
6565
CPPCHECK_OPTS+=" --cppcheck-build-dir=.out ."
6666

6767
RETURN=0
68+
69+
# Disallow non-ASCII characters in workspace path
70+
workspace=$(git rev-parse --show-toplevel)
71+
if echo "$workspace" | grep -q "[一-龥]"; then
72+
echo "[!] The workspace path '$workspace' contains non-ASCII characters." >&2
73+
exit 1
74+
fi
75+
6876
CLANG_FORMAT=$(which clang-format)
6977
if [ $? -ne 0 ]; then
7078
echo "[!] clang-format not installed. Unable to check source file format policy." >&2

0 commit comments

Comments
 (0)