Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -822,6 +822,14 @@ export class CopilotCLIChatSessionParticipant extends Disposable {
const cachedRepo = this._repositoryCacheInEmptyWorkspace.get(repoPath);
// If we have repo then it's trusted, let's get the latest information again by requesting the repo again.
if (cachedRepo) {
const trusted = await this.workspaceService.requestResourceTrust({ uri: repoPath, message: untrustedFolderMessage });
if (!trusted) {
// User didn't trust, we can't proceed.
const result = { repository: undefined, trusted: false };
this._repositoryCacheInEmptyWorkspace.set(repoPath, result);
return result;
}

const repository = await this.gitService.getRepository(repoPath, true);
return { repository, trusted: true };
}
Expand Down Expand Up @@ -1194,6 +1202,15 @@ export class CopilotCLIChatSessionParticipant extends Disposable {
}
}

// Verify trust for the working directory
if (!cancelled && workingDirectory) {
const trusted = await this.workspaceService.requestResourceTrust({ uri: workingDirectory, message: untrustedFolderMessage });
if (!trusted) {
stream.warning(l10n.t('The selected folder is not trusted.'));
cancelled = true;
}
}

// Migrate changes from active repository to worktree (only if we have a worktree, not for workspace folders without git)
if (worktreeProperties?.worktreePath && !isWorkspaceFolderWithoutRepo && (uncommittedChangesAction === 'move' || uncommittedChangesAction === 'copy')) {
await this.moveOrCopyChangesToWorkTree(Uri.file(worktreeProperties.repositoryPath), Uri.file(worktreeProperties.worktreePath), uncommittedChangesAction, stream, token);
Expand Down
Loading