diff --git a/extensions/git/package.json b/extensions/git/package.json index 3e049ddd7e5..2ba6515e963 100644 --- a/extensions/git/package.json +++ b/extensions/git/package.json @@ -1194,7 +1194,7 @@ { "command": "git.openFile", "group": "navigation", - "when": "config.git.enabled && gitOpenRepositoryCount != 0 && isInDiffEditor && resourceScheme =~ /^gitfs$|^file$/" + "when": "config.git.enabled && gitOpenRepositoryCount != 0 && isInDiffEditor && resourceScheme =~ /^git$|^file$/" }, { "command": "git.openChange", @@ -1204,44 +1204,44 @@ { "command": "git.stageSelectedRanges", "group": "2_git@1", - "when": "config.git.enabled && gitOpenRepositoryCount != 0 && isInDiffEditor && resourceScheme =~ /^gitfs$|^file$/" + "when": "config.git.enabled && gitOpenRepositoryCount != 0 && isInDiffEditor && resourceScheme =~ /^git$|^file$/" }, { "command": "git.unstageSelectedRanges", "group": "2_git@2", - "when": "config.git.enabled && gitOpenRepositoryCount != 0 && isInDiffEditor && resourceScheme =~ /^gitfs$|^file$/" + "when": "config.git.enabled && gitOpenRepositoryCount != 0 && isInDiffEditor && resourceScheme =~ /^git$|^file$/" }, { "command": "git.revertSelectedRanges", "group": "2_git@3", - "when": "config.git.enabled && gitOpenRepositoryCount != 0 && isInDiffEditor && resourceScheme =~ /^gitfs$|^file$/" + "when": "config.git.enabled && gitOpenRepositoryCount != 0 && isInDiffEditor && resourceScheme =~ /^git$|^file$/" } ], "editor/context": [ { "command": "git.stageSelectedRanges", "group": "2_git@1", - "when": "isInDiffRightEditor && config.git.enabled && gitOpenRepositoryCount != 0 && isInDiffEditor && resourceScheme =~ /^gitfs$|^file$/" + "when": "isInDiffRightEditor && config.git.enabled && gitOpenRepositoryCount != 0 && isInDiffEditor && resourceScheme =~ /^git$|^file$/" }, { "command": "git.unstageSelectedRanges", "group": "2_git@2", - "when": "isInDiffRightEditor && config.git.enabled && gitOpenRepositoryCount != 0 && isInDiffEditor && resourceScheme =~ /^gitfs$|^file$/" + "when": "isInDiffRightEditor && config.git.enabled && gitOpenRepositoryCount != 0 && isInDiffEditor && resourceScheme =~ /^git$|^file$/" }, { "command": "git.revertSelectedRanges", "group": "2_git@3", - "when": "isInDiffRightEditor && config.git.enabled && gitOpenRepositoryCount != 0 && isInDiffEditor && resourceScheme =~ /^gitfs$|^file$/" + "when": "isInDiffRightEditor && config.git.enabled && gitOpenRepositoryCount != 0 && isInDiffEditor && resourceScheme =~ /^git$|^file$/" } ], "scm/change/title": [ { "command": "git.stageChange", - "when": "originalResourceScheme == gitfs" + "when": "originalResourceScheme == git" }, { "command": "git.revertChange", - "when": "originalResourceScheme == gitfs" + "when": "originalResourceScheme == git" } ] }, diff --git a/extensions/git/src/fileSystemProvider.ts b/extensions/git/src/fileSystemProvider.ts index 2799b95bda9..1168906dc30 100644 --- a/extensions/git/src/fileSystemProvider.ts +++ b/extensions/git/src/fileSystemProvider.ts @@ -47,9 +47,9 @@ export class GitFileSystemProvider implements FileSystemProvider { this.disposables.push( model.onDidChangeRepository(this.onDidChangeRepository, this), model.onDidChangeOriginalResource(this.onDidChangeOriginalResource, this), - workspace.registerFileSystemProvider('gitfs', this, { isReadonly: true, isCaseSensitive: true }), + workspace.registerFileSystemProvider('git', this, { isReadonly: true, isCaseSensitive: true }), workspace.registerResourceLabelFormatter({ - scheme: 'gitfs', + scheme: 'git', formatting: { label: '${path} (git)', separator: '/' diff --git a/extensions/git/src/model.ts b/extensions/git/src/model.ts index 60ed1744434..bb664235103 100644 --- a/extensions/git/src/model.ts +++ b/extensions/git/src/model.ts @@ -392,7 +392,7 @@ export class Model { if (hint instanceof Uri) { let resourcePath: string; - if (hint.scheme === 'git' || hint.scheme === 'gitfs') { + if (hint.scheme === 'git') { resourcePath = fromGitUri(hint).path; } else { resourcePath = hint.fsPath; diff --git a/extensions/git/src/uri.ts b/extensions/git/src/uri.ts index 3ef84a642f7..94e6b5e38ae 100644 --- a/extensions/git/src/uri.ts +++ b/extensions/git/src/uri.ts @@ -4,7 +4,6 @@ *--------------------------------------------------------------------------------------------*/ import { Uri } from 'vscode'; -import * as qs from 'querystring'; export interface GitUriParams { path: string; @@ -13,25 +12,11 @@ export interface GitUriParams { } export function isGitUri(uri: Uri): boolean { - return /^git(fs)?$/.test(uri.scheme); + return /^git$/.test(uri.scheme); } export function fromGitUri(uri: Uri): GitUriParams { - const result = qs.parse(uri.query) as any; - - if (!result) { - throw new Error('Invalid git URI: empty query'); - } - - if (typeof result.path !== 'string') { - throw new Error('Invalid git URI: missing path'); - } - - if (typeof result.ref !== 'string') { - throw new Error('Invalid git URI: missing ref'); - } - - return result; + return JSON.parse(uri.query); } export interface GitUriOptions { @@ -61,8 +46,8 @@ export function toGitUri(uri: Uri, ref: string, options: GitUriOptions = {}): Ur } return uri.with({ - scheme: 'gitfs', + scheme: 'git', path, - query: qs.stringify(params as any) + query: JSON.stringify(params) }); } diff --git a/extensions/image-preview/src/preview.ts b/extensions/image-preview/src/preview.ts index 8ada2d8ee14..5e733b13cc2 100644 --- a/extensions/image-preview/src/preview.ts +++ b/extensions/image-preview/src/preview.ts @@ -236,7 +236,7 @@ class Preview extends Disposable { } private async getResourcePath(webviewEditor: vscode.WebviewPanel, resource: vscode.Uri, version: string): Promise { - if (resource.scheme === 'gitfs') { + if (resource.scheme === 'git') { const stat = await vscode.workspace.fs.stat(resource); if (stat.size === 0) { return this.emptyPngDataUri; diff --git a/src/vs/workbench/services/search/common/searchService.ts b/src/vs/workbench/services/search/common/searchService.ts index 44fc4a83259..990d4637b07 100644 --- a/src/vs/workbench/services/search/common/searchService.ts +++ b/src/vs/workbench/services/search/common/searchService.ts @@ -406,7 +406,7 @@ export class SearchService extends Disposable implements ISearchService { } // Exclude files from the git FileSystemProvider, e.g. to prevent open staged files from showing in search results - if (resource.scheme === 'gitfs') { + if (resource.scheme === 'git') { return; }