Commit 3f14ff4
fix(powershell): stop create-new-feature crashing on a non-Latin description (#4138)
Get-BranchName's fallback assumed the pipeline yields at least one element:
$fallbackWords = ($result -split '-') | Where-Object { $_ } | ...
return [string]::Join('-', $fallbackWords)
ConvertTo-CleanBranchName blanks every non-[a-z0-9] character, so a
description written in any non-Latin script leaves nothing for the pipeline
to emit. It yields $null, [string]::Join throws ArgumentNullException, and
$ErrorActionPreference = 'Stop' makes that terminating — the script dies
with a .NET stack trace, empty stdout, exit 1.
Measured with all three twins installed in one project:
desc='добавить авторизацию'
bash rc=0 BRANCH_NAME='001-'
py rc=0 BRANCH_NAME='001-'
ps rc=1 Exception calling "Join" ...
Identical for 添加用户认证 and '!!! ??? ***'. This hits every PowerShell
user who phrases a feature in their own language.
Wrap the pipeline in @() so it stays an array; Join on an empty array
returns "", matching the twins. Verified the normal case is unchanged
('a-to-the-of' -> 'a-to-the', 'add user authentication' ->
'001-user-authentication'), and the file stays ASCII-only (0 non-ASCII
bytes) for tests/test_ps1_encoding.py.
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent cc505da commit 3f14ff4
2 files changed
Lines changed: 61 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
165 | | - | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
166 | 173 | | |
167 | 174 | | |
168 | 175 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1065 | 1065 | | |
1066 | 1066 | | |
1067 | 1067 | | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
0 commit comments