Skip to content

Commit dd7b6dc

Browse files
MarcoDotIOclaude
andcommitted
fix(shared): branch names keep accented letters as plain letters
Branch sanitizing dropped every non-ASCII letter, so a generated or typed name like "añadir validación" became "a-adir-validaci-n". Fold accents to ASCII first, as new project folder names already do. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 812c0a7 commit dd7b6dc

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

‎packages/shared/src/git.test.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,12 @@ describe("sanitizeFeatureBranchName", () => {
253253
])("keeps the fallback for unprefixed input %s", (input, expected) => {
254254
expect(sanitizeFeatureBranchName(input)).toBe(expected);
255255
});
256+
257+
it("keeps accented letters as their plain letters", () => {
258+
expect(sanitizeFeatureBranchName("fix/Añadir validación del café")).toBe(
259+
"fix/anadir-validacion-del-cafe",
260+
);
261+
});
256262
});
257263

258264
describe("resolveAutoFeatureBranchName", () => {

‎packages/shared/src/git.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ const TEMP_WORKTREE_BRANCH_PATTERN = new RegExp(
1919

2020
export function sanitizeBranchFragment(raw: string): string {
2121
const normalized = raw
22+
// Fold accented letters to ASCII so "validación" keeps its "o" instead of splitting the word.
23+
.normalize("NFKD")
24+
.replace(/[̀-ͯ]/g, "")
2225
.trim()
2326
.toLowerCase()
2427
.replace(/['"`]/g, "")

0 commit comments

Comments
 (0)