未验证 提交 a398adac 编写于 作者: J Joao Moreno

revert git uri changes

fixes #88775
上级 e1f1744c
......@@ -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"
}
]
},
......
......@@ -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: '/'
......
......@@ -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;
......
......@@ -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)
});
}
......@@ -236,7 +236,7 @@ class Preview extends Disposable {
}
private async getResourcePath(webviewEditor: vscode.WebviewPanel, resource: vscode.Uri, version: string): Promise<string> {
if (resource.scheme === 'gitfs') {
if (resource.scheme === 'git') {
const stat = await vscode.workspace.fs.stat(resource);
if (stat.size === 0) {
return this.emptyPngDataUri;
......
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册