Skip to content

fix(validators): accept { in a branch name, refusing only @{ (#324) - #338

Merged
baldurpan merged 2 commits into
mainfrom
324-isvalidbranchname-refuses-anywhere-though-git
Nov 8, 2026
Merged

baldurpan merged 2 commits into
mainfrom
324-isvalidbranchname-refuses-anywhere-though-git

Conversation

@baldurpan

Copy link
Copy Markdown
Contributor

Closes #324

What changed

  • isValidBranchName (src/lib/validators.ts) no longer refuses { on its own. That fixes worktree branch, worktree rename and worktree config --user defaultSourceBranch for names such as a{b and origin/a{b, which git check-ref-format --branch accepts.
  • @{ is still refused. The { in the character class used to cover it; a separate /@\{/ rule does now, with the same message (Branch name contains invalid characters).
  • Tests: new rows in validators.test.ts accept a{b, {x} and origin/a{b. The existing branch@{upstream} and branch@{ rows still expect the refusal.
  • Release note: .changeset/brace-branches.md, patch (confirmed by the maintainer).

Gates

  • Gate 1 (from context/verify.md): pnpm check, pnpm typecheck, pnpm build and pnpm test (55 files, 3808 tests) passed, and so did pnpm docs:test (748 tests). pnpm --filter docs typecheck, pnpm docs:build and worker:bundle-check were not run. This change touches no docs code.
  • Gate 2 (the reviewer subagent): PASS WITH NOTES, with nothing blocking. The reviewer checked every case against git check-ref-format --branch. a{b, {x}, origin/a{b, { and } are valid. @{, a@{b, branch@{ and branch@{upstream} are not.

Docs

docs/, README.md and skills/ were searched, and none of them says { is refused. Nothing needed changing.

git check-ref-format forbids { only as part of @{, so worktree branch,
worktree rename and the defaultSourceBranch config refused names such
as a{b that git accepts. @{ is now refused by a rule of its own.

Closes #324
@baldurpan baldurpan added the bug Something isn't working label Nov 8, 2026

@baldurs-reviewer baldurs-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code-reviewer: looks good

The PR narrows isValidBranchName so that { on its own is accepted, while the git-forbidden sequence @{ is still refused by a separate /@\{/ rule with the same message. The new rule matches git check-ref-format. Tests cover a brace inside a name, braces around a name and a brace in a later component, and the existing @{ refusal rows still pass. The changeset is accurate. I found nothing that needs changing.


Reviewed 80ae46b for baldurpan · claude-opus-5-5 · 3 files · $0.12

@baldurpan
baldurpan merged commit ba39368 into main Nov 8, 2026
2 checks passed
@baldurpan
baldurpan deleted the 324-isvalidbranchname-refuses-anywhere-though-git branch November 8, 2026 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

isValidBranchName refuses { anywhere, though git only forbids @{

1 participant