Merge from vscode 3c6f6af7347d38e87bc6406024e8dcf9e9bce229 (#8962)

* Merge from vscode 3c6f6af7347d38e87bc6406024e8dcf9e9bce229

* skip failing tests

* update mac build image
This commit is contained in:
Anthony Dresser
2020-01-27 15:28:17 -08:00
committed by Karl Burtram
parent 0eaee18dc4
commit fefe1454de
481 changed files with 12764 additions and 7836 deletions

View File

@@ -239,5 +239,10 @@ export class ApiImpl implements API {
return toGitUri(uri, ref);
}
getRepository(uri: Uri): Repository | null {
const result = this._model.getRepository(uri);
return result ? new ApiRepository(result) : null;
}
constructor(private _model: Model) { }
}

View File

@@ -187,6 +187,7 @@ export interface API {
readonly onDidCloseRepository: Event<Repository>;
toGitUri(uri: Uri, ref: string): Uri;
getRepository(uri: Uri): Repository | null;
}
export interface GitExtension {

View File

@@ -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: '/'

View File

@@ -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;

View File

@@ -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)
});
}