@@ -125,10 +125,11 @@ export class ChatSessionWorktreeService extends Disposable implements IChatSessi
125125 }
126126
127127 private async generateBranchName ( preferredName : string | undefined , repository : RepoContext ) {
128- const branchPrefix = vscode . workspace . getConfiguration ( 'git' ) . get < string > ( 'branchPrefix' ) ?? '' ;
128+ const branchPrefixConfig = vscode . workspace . getConfiguration ( 'git' ) . get < string > ( 'branchPrefix' ) ?? '' ;
129+ const branchPrefix = this . agentSessionsWorkspace . isAgentSessionsWorkspace ? 'agents' : 'copilot' ;
129130
130131 if ( preferredName ) {
131- let branchName = `${ branchPrefix } copilot /${ preferredName } ` ;
132+ let branchName = `${ branchPrefixConfig } ${ branchPrefix } /${ preferredName } ` ;
132133 // Check if we already have a branch with the preferred name, and if not, then use it.
133134 // Else suffix the preferred name with a random string to avoid conflicts.
134135 const refs = await this . gitService . getRefs ( repository . rootUri , { pattern : `refs/heads/${ branchName } ` } ) ;
@@ -142,8 +143,8 @@ export class ChatSessionWorktreeService extends Disposable implements IChatSessi
142143 // Attempt to generate a random branch name for the worktree
143144 const randomBranchName = await this . gitService . generateRandomBranchName ( repository . rootUri ) ;
144145
145- const branch = randomBranchName ? `${ branchPrefix } copilot /${ randomBranchName . substring ( branchPrefix . length ) } `
146- : `${ branchPrefix } copilot /worktree-${ new Date ( ) . toISOString ( ) . replace ( / [: .] / g, '-' ) . slice ( 0 , 19 ) } ` ;
146+ const branch = randomBranchName ? `${ branchPrefixConfig } ${ branchPrefix } /${ randomBranchName . substring ( branchPrefixConfig . length ) } `
147+ : `${ branchPrefixConfig } ${ branchPrefix } /worktree-${ new Date ( ) . toISOString ( ) . replace ( / [: .] / g, '-' ) . slice ( 0 , 19 ) } ` ;
147148
148149 return branch ;
149150 }
0 commit comments