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:
co-authored by
Orca
Neil
parent
ca36072295
commit
f7a4100bc7
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user