@@ -13,7 +13,7 @@ import { ILogService } from '../../../platform/log/common/logService';
1313import { IWorkspaceService } from '../../../platform/workspace/common/workspaceService' ;
1414import { Disposable } from '../../../util/vs/base/common/lifecycle' ;
1515import * as path from '../../../util/vs/base/common/path' ;
16- import { basename , isEqual } from '../../../util/vs/base/common/resources' ;
16+ import { basename } from '../../../util/vs/base/common/resources' ;
1717import { ChatSessionWorktreeData , ChatSessionWorktreeFile , ChatSessionWorktreeProperties , IChatSessionWorktreeService } from '../common/chatSessionWorktreeService' ;
1818
1919const CHAT_SESSION_WORKTREE_MEMENTO_KEY = 'github.copilot.cli.sessionWorktrees' ;
@@ -242,15 +242,6 @@ export class ChatSessionWorktreeService extends Disposable implements IChatSessi
242242 // so we can get them from the main repository or discovered worktree.
243243 await this . gitService . initialize ( ) ;
244244
245- // TODO@lszomoru : Remove this change to support welcome view
246- // Check whether the worktree belongs to any of the discovered repositories
247- const repository = this . gitService . repositories
248- . find ( r => r . worktrees . some ( w => isEqual ( vscode . Uri . file ( w . path ) , worktreePath ) ) ) ;
249-
250- if ( ! repository ) {
251- return undefined ;
252- }
253-
254245 if ( worktreeProperties . autoCommit === false ) {
255246 // These changes are staged in the worktree but not yet committed. Since the
256247 // changes are not committed, we need to get them from the worktree repository
@@ -293,6 +284,15 @@ export class ChatSessionWorktreeService extends Disposable implements IChatSessi
293284 return changes ;
294285 }
295286
287+ // Open the main repository that contains the worktree. We have to open
288+ // the repository so that we can run do `git diff` against the repository
289+ // to get the committed changes in the worktree branch.
290+ const repository = await this . gitService . getRepository ( vscode . Uri . file ( worktreeProperties . repositoryPath ) ) ;
291+
292+ if ( ! repository ) {
293+ return undefined ;
294+ }
295+
296296 // These changes are committed in the worktree branch but since they are
297297 // committed we can get the changes from the main repository and we do
298298 // not need to open the worktree repository.
0 commit comments