You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit f2c0f93
Browse filesBrowse the repository at this point in the historyBrowse files
fix: classify Unicode consistently on Bash across locales
Use Python 3 for non-ASCII character classification where POSIX locale classes vary by platform. Preserve the shell-only ASCII path, report a clear error when a Unicode name lacks Python, and cover both paths. Refs #4574.
Assisted-by: GitHub Copilot (model: GPT-6 Sol, autonomous)
Co-authored-by: Copilot App <[email protected]>
char if char.isalpha() or char.isdecimal() else sys.argv[1]
187
+
for char in value.translate(lower)
188
+
)
189
+
sys.stdout.buffer.write(result.encode("utf-8"))
190
+
'"$separator"
191
+
else
192
+
printf'%s'"$name"| LC_ALL=C tr '[:upper:]''[:lower:]'| LC_ALL=C sed "s/[^a-z0-9]/$separator/g"
193
+
fi
194
+
}
195
+
170
196
clean_branch_name() {
171
197
local name="$1"
172
-
local -x LC_ALL="$UNICODE_LOCALE"
173
-
printf'%s\n'"$name"| LC_ALL=C tr '[:upper:]''[:lower:]'| sed 's/[^[:alnum:]]/-/g'| sed 's/--*/-/g'| sed 's/^-//'| sed 's/-$//'
198
+
local cleaned
199
+
cleaned=$(unicode_words "$name"'-')||return 1
200
+
printf'%s\n'"$cleaned"| sed 's/--*/-/g'| sed 's/^-//'| sed 's/-$//'
174
201
}
175
202
176
203
branch_byte_count() {
@@ -232,10 +259,10 @@ generate_branch_name() {
232
259
# Common stop words to filter out
233
260
local stop_words="^(i|a|an|the|to|for|of|in|on|at|by|with|from|is|are|was|were|be|been|being|have|has|had|do|does|did|will|would|should|could|can|may|might|must|shall|this|that|these|those|my|your|our|their|want|need|add|get|set)$"
234
261
235
-
# Use a UTF-8 locale for Unicode character classes. Lowercase only ASCII
236
-
# so results do not depend on the platform's multibyte case conversion.
262
+
# Use a UTF-8 locale for character-safe length checks and split words.
237
263
local -x LC_ALL="$UNICODE_LOCALE"
238
-
local clean_name=$(printf '%s\n'"$description"| LC_ALL=C tr '[:upper:]''[:lower:]'| sed 's/[^[:alnum:]]/ /g')
0 commit comments