@@ -19,6 +19,7 @@ import { ITelemetryService } from '../../../platform/telemetry/common/telemetry'
1919import { IWorkspaceService } from '../../../platform/workspace/common/workspaceService' ;
2020import { isUri } from '../../../util/common/types' ;
2121import { DeferredPromise } from '../../../util/vs/base/common/async' ;
22+ import { CancellationToken } from '../../../util/vs/base/common/cancellation' ;
2223import { isCancellationError } from '../../../util/vs/base/common/errors' ;
2324import { Emitter , Event } from '../../../util/vs/base/common/event' ;
2425import { Disposable , DisposableStore , IDisposable , IReference , toDisposable } from '../../../util/vs/base/common/lifecycle' ;
@@ -44,7 +45,6 @@ import { isCopilotCLIPlanAgent } from './copilotCLIPlanAgentProvider';
4445import { convertReferenceToVariable } from './copilotCLIPromptReferences' ;
4546import { ICopilotCLITerminalIntegration , TerminalOpenLocation } from './copilotCLITerminalIntegration' ;
4647import { CopilotCloudSessionsProvider } from './copilotCloudSessionsProvider' ;
47- import { CancellationToken } from '../../../util/vs/base/common/cancellation' ;
4848
4949const AGENTS_OPTION_ID = 'agent' ;
5050const REPOSITORY_OPTION_ID = 'repository' ;
@@ -509,28 +509,20 @@ export class CopilotCLIChatSessionContentProvider extends Disposable implements
509509 } ;
510510 }
511511 const worktreeProperties = await this . copilotCLIWorktreeManagerService . getWorktreeProperties ( copilotcliSessionId ) ;
512- // Ensure that the repository for the background session is opened. This is needed
513- // when the background session is opened in the empty window so that we can access
514- // the changes of the background session.
515- if ( worktreeProperties ?. repositoryPath ) {
516- const repoUri = vscode . Uri . file ( worktreeProperties . repositoryPath ) ;
517- await this . gitService . getRepository ( repoUri ) ;
518- // Ensure the repo is opened so we can compute the diff of the files.
519- await this . gitService . getRepository ( vscode . Uri . file ( worktreeProperties . worktreePath ) ) ;
520- if ( isBranchOptionFeatureEnabled ( this . configurationService ) ) {
521- const branchName = worktreeProperties . version === 1
522- ? worktreeProperties . branchName
523- : worktreeProperties . baseBranchName ;
512+ if ( worktreeProperties ?. repositoryPath && isBranchOptionFeatureEnabled ( this . configurationService ) ) {
513+ const branchName = worktreeProperties . version === 1
514+ ? worktreeProperties . branchName
515+ : worktreeProperties . baseBranchName ;
524516
525- this . _selectedRepoForBranches = { repoUri, headBranchName : branchName } ;
517+ const repoUri = vscode . Uri . file ( worktreeProperties . repositoryPath ) ;
518+ this . _selectedRepoForBranches = { repoUri, headBranchName : branchName } ;
526519
527- options [ BRANCH_OPTION_ID ] = {
528- id : branchName ,
529- name : branchName ,
530- icon : new vscode . ThemeIcon ( 'git-branch' ) ,
531- locked : true
532- } ;
533- }
520+ options [ BRANCH_OPTION_ID ] = {
521+ id : branchName ,
522+ name : branchName ,
523+ icon : new vscode . ThemeIcon ( 'git-branch' ) ,
524+ locked : true
525+ } ;
534526 }
535527 if ( isIsolationOptionFeatureEnabled ( this . configurationService ) ) {
536528 const isWorktree = ! ! worktreeProperties ;
0 commit comments