Skip to content

Commit a398ada

Browse files
committed
revert git uri changes
fixes microsoft#88775
1 parent e1f1744 commit a398ada

File tree

6 files changed

+18
-33
lines changed

6 files changed

+18
-33
lines changed

extensions/git/package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1194,7 +1194,7 @@
11941194
{
11951195
"command": "git.openFile",
11961196
"group": "navigation",
1197-
"when": "config.git.enabled && gitOpenRepositoryCount != 0 && isInDiffEditor && resourceScheme =~ /^gitfs$|^file$/"
1197+
"when": "config.git.enabled && gitOpenRepositoryCount != 0 && isInDiffEditor && resourceScheme =~ /^git$|^file$/"
11981198
},
11991199
{
12001200
"command": "git.openChange",
@@ -1204,44 +1204,44 @@
12041204
{
12051205
"command": "git.stageSelectedRanges",
12061206
"group": "2_git@1",
1207-
"when": "config.git.enabled && gitOpenRepositoryCount != 0 && isInDiffEditor && resourceScheme =~ /^gitfs$|^file$/"
1207+
"when": "config.git.enabled && gitOpenRepositoryCount != 0 && isInDiffEditor && resourceScheme =~ /^git$|^file$/"
12081208
},
12091209
{
12101210
"command": "git.unstageSelectedRanges",
12111211
"group": "2_git@2",
1212-
"when": "config.git.enabled && gitOpenRepositoryCount != 0 && isInDiffEditor && resourceScheme =~ /^gitfs$|^file$/"
1212+
"when": "config.git.enabled && gitOpenRepositoryCount != 0 && isInDiffEditor && resourceScheme =~ /^git$|^file$/"
12131213
},
12141214
{
12151215
"command": "git.revertSelectedRanges",
12161216
"group": "2_git@3",
1217-
"when": "config.git.enabled && gitOpenRepositoryCount != 0 && isInDiffEditor && resourceScheme =~ /^gitfs$|^file$/"
1217+
"when": "config.git.enabled && gitOpenRepositoryCount != 0 && isInDiffEditor && resourceScheme =~ /^git$|^file$/"
12181218
}
12191219
],
12201220
"editor/context": [
12211221
{
12221222
"command": "git.stageSelectedRanges",
12231223
"group": "2_git@1",
1224-
"when": "isInDiffRightEditor && config.git.enabled && gitOpenRepositoryCount != 0 && isInDiffEditor && resourceScheme =~ /^gitfs$|^file$/"
1224+
"when": "isInDiffRightEditor && config.git.enabled && gitOpenRepositoryCount != 0 && isInDiffEditor && resourceScheme =~ /^git$|^file$/"
12251225
},
12261226
{
12271227
"command": "git.unstageSelectedRanges",
12281228
"group": "2_git@2",
1229-
"when": "isInDiffRightEditor && config.git.enabled && gitOpenRepositoryCount != 0 && isInDiffEditor && resourceScheme =~ /^gitfs$|^file$/"
1229+
"when": "isInDiffRightEditor && config.git.enabled && gitOpenRepositoryCount != 0 && isInDiffEditor && resourceScheme =~ /^git$|^file$/"
12301230
},
12311231
{
12321232
"command": "git.revertSelectedRanges",
12331233
"group": "2_git@3",
1234-
"when": "isInDiffRightEditor && config.git.enabled && gitOpenRepositoryCount != 0 && isInDiffEditor && resourceScheme =~ /^gitfs$|^file$/"
1234+
"when": "isInDiffRightEditor && config.git.enabled && gitOpenRepositoryCount != 0 && isInDiffEditor && resourceScheme =~ /^git$|^file$/"
12351235
}
12361236
],
12371237
"scm/change/title": [
12381238
{
12391239
"command": "git.stageChange",
1240-
"when": "originalResourceScheme == gitfs"
1240+
"when": "originalResourceScheme == git"
12411241
},
12421242
{
12431243
"command": "git.revertChange",
1244-
"when": "originalResourceScheme == gitfs"
1244+
"when": "originalResourceScheme == git"
12451245
}
12461246
]
12471247
},

extensions/git/src/fileSystemProvider.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ export class GitFileSystemProvider implements FileSystemProvider {
4747
this.disposables.push(
4848
model.onDidChangeRepository(this.onDidChangeRepository, this),
4949
model.onDidChangeOriginalResource(this.onDidChangeOriginalResource, this),
50-
workspace.registerFileSystemProvider('gitfs', this, { isReadonly: true, isCaseSensitive: true }),
50+
workspace.registerFileSystemProvider('git', this, { isReadonly: true, isCaseSensitive: true }),
5151
workspace.registerResourceLabelFormatter({
52-
scheme: 'gitfs',
52+
scheme: 'git',
5353
formatting: {
5454
label: '${path} (git)',
5555
separator: '/'

extensions/git/src/model.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ export class Model {
392392
if (hint instanceof Uri) {
393393
let resourcePath: string;
394394

395-
if (hint.scheme === 'git' || hint.scheme === 'gitfs') {
395+
if (hint.scheme === 'git') {
396396
resourcePath = fromGitUri(hint).path;
397397
} else {
398398
resourcePath = hint.fsPath;

extensions/git/src/uri.ts

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import { Uri } from 'vscode';
7-
import * as qs from 'querystring';
87

98
export interface GitUriParams {
109
path: string;
@@ -13,25 +12,11 @@ export interface GitUriParams {
1312
}
1413

1514
export function isGitUri(uri: Uri): boolean {
16-
return /^git(fs)?$/.test(uri.scheme);
15+
return /^git$/.test(uri.scheme);
1716
}
1817

1918
export function fromGitUri(uri: Uri): GitUriParams {
20-
const result = qs.parse(uri.query) as any;
21-
22-
if (!result) {
23-
throw new Error('Invalid git URI: empty query');
24-
}
25-
26-
if (typeof result.path !== 'string') {
27-
throw new Error('Invalid git URI: missing path');
28-
}
29-
30-
if (typeof result.ref !== 'string') {
31-
throw new Error('Invalid git URI: missing ref');
32-
}
33-
34-
return result;
19+
return JSON.parse(uri.query);
3520
}
3621

3722
export interface GitUriOptions {
@@ -61,8 +46,8 @@ export function toGitUri(uri: Uri, ref: string, options: GitUriOptions = {}): Ur
6146
}
6247

6348
return uri.with({
64-
scheme: 'gitfs',
49+
scheme: 'git',
6550
path,
66-
query: qs.stringify(params as any)
51+
query: JSON.stringify(params)
6752
});
6853
}

extensions/image-preview/src/preview.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ class Preview extends Disposable {
236236
}
237237

238238
private async getResourcePath(webviewEditor: vscode.WebviewPanel, resource: vscode.Uri, version: string): Promise<string> {
239-
if (resource.scheme === 'gitfs') {
239+
if (resource.scheme === 'git') {
240240
const stat = await vscode.workspace.fs.stat(resource);
241241
if (stat.size === 0) {
242242
return this.emptyPngDataUri;

src/vs/workbench/services/search/common/searchService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ export class SearchService extends Disposable implements ISearchService {
406406
}
407407

408408
// Exclude files from the git FileSystemProvider, e.g. to prevent open staged files from showing in search results
409-
if (resource.scheme === 'gitfs') {
409+
if (resource.scheme === 'git') {
410410
return;
411411
}
412412

0 commit comments

Comments
 (0)