From 895ece5652f3a98df8b87039b11e9e5bc3f32204 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E5=87=A2?= Date: Mon, 29 Jun 2020 16:10:00 +0800 Subject: [PATCH] fix #8106:fix open deleted file in git scm errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 二凢 --- packages/git/src/browser/git-scm-provider.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/git/src/browser/git-scm-provider.ts b/packages/git/src/browser/git-scm-provider.ts index b2760a6ea5532..a86828d029a52 100644 --- a/packages/git/src/browser/git-scm-provider.ts +++ b/packages/git/src/browser/git-scm-provider.ts @@ -195,6 +195,13 @@ export class GitScmProvider implements ScmProvider { getUriToOpen(change: GitFileChange): URI { const changeUri: URI = new URI(change.uri); + if (change.status === GitFileStatus.Deleted) { + if (change.staged) { + return changeUri.withScheme(GIT_RESOURCE_SCHEME).withQuery('HEAD'); + } else { + return changeUri.withScheme(GIT_RESOURCE_SCHEME); + } + } if (change.status !== GitFileStatus.New) { if (change.staged) { return DiffUris.encode(