From 1bf610daabec2beeaa632dc1e33d92f21df41237 Mon Sep 17 00:00:00 2001 From: Ladislau Szomoru <3372902+lszomoru@users.noreply.github.com> Date: Wed, 28 Jan 2026 12:56:25 +0100 Subject: [PATCH] Git - request resource trust for the parent folder of the .git folder (#291261) --- extensions/git/src/model.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/extensions/git/src/model.ts b/extensions/git/src/model.ts index a39aeffa338..b2bcadb3a71 100644 --- a/extensions/git/src/model.ts +++ b/extensions/git/src/model.ts @@ -646,14 +646,15 @@ export class Model implements IRepositoryResolver, IBranchProtectionProviderRegi // Get .git path and real path const [dotGit, repositoryRootRealPath] = await Promise.all([this.git.getRepositoryDotGit(repositoryRoot), this.getRepositoryRootRealPath(repositoryRoot)]); - // Check that the location of the .git folder is trusted + // Check that the folder containing the .git folder is trusted + const dotGitPath = dotGit.commonPath ?? dotGit.path; const result = await workspace.requestResourceTrust({ message: l10n.t('You are opening a repository from a location that is not trusted. Do you trust the authors of the files in the repository you are opening?'), - uri: Uri.file(dotGit.commonPath ?? dotGit.path), + uri: Uri.file(path.dirname(dotGitPath)), } satisfies ResourceTrustRequestOptions); if (!result) { - this.logger.trace(`[Model][openRepository] Repository folder is not trusted: ${repoPath}`); + this.logger.trace(`[Model][openRepository] Repository folder is not trusted: ${path.dirname(dotGitPath)}`); return; }