Preserve slash branch names from branch composer (#6748)

Co-authored-by: Orca <help@stably.ai>
Co-authored-by: Neil <charlie-eng@stably.ai>
This commit is contained in:
mehmet turac
2026-07-03 17:33:22 -07:00
committed by GitHub
co-authored by Orca Neil
parent ca36072295
commit f7a4100bc7
4 changed files with 84 additions and 3 deletions
+16 -1
View File
@@ -99,14 +99,29 @@ export function resolveComposerReuseOverride(args: {
return args.branchNameOverride
}
/**
* The branch-name override to apply when creating a worktree from the composer.
*
* With no resolver-provided override, branch mode (#6721) keeps a
* slash-containing typed name as the git branch — validated downstream by
* `git check-ref-format` — while the worktree folder name is sanitized
* separately; every other mode leaves the branch to be derived from the
* sanitized name. With an override, keep it verbatim when the workspace name is
* user-edited (`preserveWorkspaceNameEdits`) or still matches the auto-name.
*/
export function resolveComposerBranchNameOverrideForCreate(args: {
branchNameOverride: string | undefined
branchAutoName: string
workspaceName: string
preserveWorkspaceNameEdits: boolean
createBranchFromWorkspaceName?: boolean
}): string | undefined {
if (!args.branchNameOverride) {
return undefined
// Why: branch mode keeps slash-containing git branch names while the
// workspace folder name may still be sanitized separately.
return args.createBranchFromWorkspaceName && args.workspaceName.includes('/')
? args.workspaceName
: undefined
}
if (args.preserveWorkspaceNameEdits) {
return args.branchNameOverride