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 89cee3e
Browse filesBrowse the repository at this point in the historyBrowse files
while [ "$(branch_byte_count "$truncated_suffix")"-gt"$max_suffix_length" ];do
193
+
truncated_suffix="${truncated_suffix%?}"
194
+
done
195
+
truncated_suffix="${truncated_suffix%-}"
172
196
branch_name="${feature_num}-${truncated_suffix}"
173
197
fi
174
198
@@ -208,27 +232,25 @@ generate_branch_name() {
208
232
# Common stop words to filter out
209
233
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)$"
210
234
211
-
# Convert to lowercase and split into words. LC_ALL=C keeps ASCII
212
-
# punctuation handling stable while non-ASCII words remain intact, and so the `grep -qw`
213
-
# acronym probe below uses ASCII word boundaries like the Python twin's
214
-
# (?<![0-9A-Za-z_]) lookarounds.
215
-
local -x LC_ALL=C
216
-
local clean_name=$(printf '%s'"$description"| tr '[:upper:]''[:lower:]'| sed 's/[[:space:][:punct:]]/ /g')
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.
237
+
local -x LC_ALL="$UNICODE_LOCALE"
238
+
local clean_name=$(printf '%s\n'"$description"| LC_ALL=C tr '[:upper:]''[:lower:]'| sed 's/[^[:alnum:]]/ /g')
217
239
218
240
# Filter words: remove stop words and words shorter than 3 chars (unless they're uppercase acronyms in original)
219
241
local meaningful_words=()
220
242
forwordin$clean_name;do
221
243
# Skip empty words
222
244
[ -z"$word" ] &&continue
223
245
224
-
#Keep words that are NOT stop words AND (length >= 3 OR are potential acronyms)
246
+
#Retain non-ASCII words even when shorter than three characters.
225
247
if!echo"$word"| grep -qiE "$stop_words";then
226
-
if [ ${#word}-ge 3 ];then
248
+
if [ ${#word}-ge 3 ]||printf'%s'"$word"| LC_ALL=C grep -q '[^ -~]';then
227
249
meaningful_words+=("$word")
228
250
# Keep short words that appear as an uppercase acronym in the original.
229
251
# Uppercase via tr and match with grep -w (both portable) rather than
230
252
# bash's 4+ "^^" case expansion (breaks on macOS bash 3.2) and \b (non-POSIX).
echo"[specify] Warning: Feature name is empty after removing unsupported characters. Use --short-name with ASCII letters or digits (for example, user-auth).">&2
290
+
echo"[specify] Warning: Feature name is empty after removing unsupported characters. Use --short-name with letters or digits (for example, user-auth).">&2
269
291
fi
270
292
271
293
# Warn if --number and --timestamp are both specified
# Keep short words only if they appear as uppercase in original (likely
@@ -180,7 +208,7 @@ if ($ShortName) {
180
208
}
181
209
182
210
if (-not$branchSuffix) {
183
-
[Console]::Error.WriteLine("[specify] Warning: Feature name is empty after removing unsupported characters. Use -ShortName with ASCII letters or digits (for example, user-auth).")
211
+
[Console]::Error.WriteLine("[specify] Warning: Feature name is empty after removing unsupported characters. Use -ShortName with letters or digits (for example, user-auth).")
184
212
}
185
213
186
214
# Treat an explicit empty string as omitted, matching the bash and Python twins.
0 commit comments