VS Code merge to df8fe74bd55313de0dd2303bc47a4aab0ca56b0e (#17979)

* Merge from vscode 504f934659740e9d41501cad9f162b54d7745ad9

* delete unused folders

* distro

* Bump build node version

* update chokidar

* FIx hygiene errors

* distro

* Fix extension lint issues

* Remove strict-vscode

* Add copyright header exemptions

* Bump vscode-extension-telemetry to fix webpacking issue with zone.js

* distro

* Fix failing tests (revert marked.js back to current one until we decide to update)

* Skip searchmodel test

* Fix mac build

* temp debug script loading

* Try disabling coverage

* log error too

* Revert "log error too"

This reverts commit af0183e5d4ab458fdf44b88fbfab9908d090526f.

* Revert "temp debug script loading"

This reverts commit 3d687d541c76db2c5b55626c78ae448d3c25089c.

* Add comments explaining coverage disabling

* Fix ansi_up loading issue

* Merge latest from ads

* Use newer option

* Fix compile

* add debug logging warn

* Always log stack

* log more

* undo debug

* Update to use correct base path (+cleanup)

* distro

* fix compile errors

* Remove strict-vscode

* Fix sql editors not showing

* Show db dropdown input & fix styling

* Fix more info in gallery

* Fix gallery asset requests

* Delete unused workflow

* Fix tapable resolutions for smoke test compile error

* Fix smoke compile

* Disable crash reporting

* Disable interactive

Co-authored-by: ADS Merger <karlb@microsoft.com>
This commit is contained in:
Charles Gagnon
2022-01-06 09:06:56 -08:00
committed by GitHub
parent fd2736b6a6
commit 2bc6a0cd01
2099 changed files with 79520 additions and 43813 deletions

View File

@@ -577,7 +577,7 @@
},
{
"command": "git.openChange",
"when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"
"when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0 && resourcePath in git.changedResources"
},
{
"command": "git.stage",
@@ -1324,7 +1324,7 @@
{
"command": "git.openChange",
"group": "navigation",
"when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0 && !isInDiffEditor && resourceScheme == file"
"when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0 && !isInDiffEditor && resourceScheme == file && resourcePath in git.changedResources"
},
{
"command": "git.stageSelectedRanges",
@@ -1553,10 +1553,10 @@
"command": "git.branchFrom",
"group": "branch@4"
},
{
"command": "git.renameBranch",
"group": "branch@5"
},
{
"command": "git.renameBranch",
"group": "branch@5"
},
{
"command": "git.deleteBranch",
"group": "branch@6"
@@ -1692,8 +1692,15 @@
"default": true
},
"git.autofetch": {
"type": ["boolean", "string"],
"enum": [true, false, "all"],
"type": [
"boolean",
"string"
],
"enum": [
true,
false,
"all"
],
"scope": "resource",
"markdownDescription": "%config.autofetch%",
"default": false,
@@ -2376,7 +2383,7 @@
"file-type": "^7.2.0",
"iconv-lite-umd": "0.6.8",
"jschardet": "2.3.0",
"vscode-extension-telemetry": "0.1.7",
"vscode-extension-telemetry": "0.2.8",
"vscode-nls": "^4.0.0",
"vscode-uri": "^2.0.0",
"which": "^1.3.0"

View File

@@ -169,7 +169,7 @@
"config.useForcePushWithLease": "Controls whether force pushing uses the safer force-with-lease variant.",
"config.confirmForcePush": "Controls whether to ask for confirmation before force-pushing.",
"config.allowNoVerifyCommit": "Controls whether commits without running pre-commit and commit-msg hooks are allowed.",
"config.confirmNoVerifyCommit": "Controls whether to ask for confirmation before commiting without verification.",
"config.confirmNoVerifyCommit": "Controls whether to ask for confirmation before committing without verification.",
"config.openDiffOnClick": "Controls whether the diff editor should be opened when clicking a change. Otherwise the regular editor will be opened.",
"config.supportCancellation": "Controls whether a notification comes up when running the Sync action, which allows the user to cancel the operation.",
"config.branchSortOrder": "Controls the sort order for branches.",

View File

@@ -63,9 +63,11 @@ function parseVersion(raw: string): string {
return raw.replace(/^git version /, '');
}
function findSpecificGit(path: string, onLookup: (path: string) => void): Promise<IGit> {
function findSpecificGit(path: string, onValidate: (path: string) => boolean): Promise<IGit> {
return new Promise<IGit>((c, e) => {
onLookup(path);
if (!onValidate(path)) {
return e('git not found');
}
const buffers: Buffer[] = [];
const child = cp.spawn(path, ['--version']);
@@ -75,7 +77,7 @@ function findSpecificGit(path: string, onLookup: (path: string) => void): Promis
});
}
function findGitDarwin(onLookup: (path: string) => void): Promise<IGit> {
function findGitDarwin(onValidate: (path: string) => boolean): Promise<IGit> {
return new Promise<IGit>((c, e) => {
cp.exec('which git', (err, gitPathBuffer) => {
if (err) {
@@ -85,7 +87,9 @@ function findGitDarwin(onLookup: (path: string) => void): Promise<IGit> {
const path = gitPathBuffer.toString().replace(/^\s+|\s+$/g, '');
function getVersion(path: string) {
onLookup(path);
if (!onValidate(path)) {
return e('git not found');
}
// make sure git executes
cp.exec('git --version', (err, stdout) => {
@@ -117,33 +121,31 @@ function findGitDarwin(onLookup: (path: string) => void): Promise<IGit> {
});
}
function findSystemGitWin32(base: string, onLookup: (path: string) => void): Promise<IGit> {
function findSystemGitWin32(base: string, onValidate: (path: string) => boolean): Promise<IGit> {
if (!base) {
return Promise.reject<IGit>('Not found');
}
return findSpecificGit(path.join(base, 'Git', 'cmd', 'git.exe'), onLookup);
return findSpecificGit(path.join(base, 'Git', 'cmd', 'git.exe'), onValidate);
}
function findGitWin32InPath(onLookup: (path: string) => void): Promise<IGit> {
function findGitWin32InPath(onValidate: (path: string) => boolean): Promise<IGit> {
const whichPromise = new Promise<string>((c, e) => which('git.exe', (err, path) => err ? e(err) : c(path)));
return whichPromise.then(path => findSpecificGit(path, onLookup));
return whichPromise.then(path => findSpecificGit(path, onValidate));
}
function findGitWin32(onLookup: (path: string) => void): Promise<IGit> {
return findSystemGitWin32(process.env['ProgramW6432'] as string, onLookup)
.then(undefined, () => findSystemGitWin32(process.env['ProgramFiles(x86)'] as string, onLookup))
.then(undefined, () => findSystemGitWin32(process.env['ProgramFiles'] as string, onLookup))
.then(undefined, () => findSystemGitWin32(path.join(process.env['LocalAppData'] as string, 'Programs'), onLookup))
.then(undefined, () => findGitWin32InPath(onLookup));
function findGitWin32(onValidate: (path: string) => boolean): Promise<IGit> {
return findSystemGitWin32(process.env['ProgramW6432'] as string, onValidate)
.then(undefined, () => findSystemGitWin32(process.env['ProgramFiles(x86)'] as string, onValidate))
.then(undefined, () => findSystemGitWin32(process.env['ProgramFiles'] as string, onValidate))
.then(undefined, () => findSystemGitWin32(path.join(process.env['LocalAppData'] as string, 'Programs'), onValidate))
.then(undefined, () => findGitWin32InPath(onValidate));
}
export async function findGit(hint: string | string[] | undefined, onLookup: (path: string) => void): Promise<IGit> {
const hints = Array.isArray(hint) ? hint : hint ? [hint] : [];
export async function findGit(hints: string[], onValidate: (path: string) => boolean): Promise<IGit> {
for (const hint of hints) {
try {
return await findSpecificGit(hint, onLookup);
return await findSpecificGit(hint, onValidate);
} catch {
// noop
}
@@ -151,9 +153,9 @@ export async function findGit(hint: string | string[] | undefined, onLookup: (pa
try {
switch (process.platform) {
case 'darwin': return await findGitDarwin(onLookup);
case 'win32': return await findGitWin32(onLookup);
default: return await findSpecificGit('git', onLookup);
case 'darwin': return await findGitDarwin(onValidate);
case 'win32': return await findGitWin32(onValidate);
default: return await findSpecificGit('git', onValidate);
}
} catch {
// noop

View File

@@ -18,7 +18,7 @@ import TelemetryReporter from 'vscode-extension-telemetry';
import { GitExtension } from './api/git';
import { GitProtocolHandler } from './protocolHandler';
import { GitExtensionImpl } from './api/extension';
// import * as path from 'path'; {{SQL CARBON EDIT}}
import * as path from 'path';
// import * as fs from 'fs';
import * as os from 'os';
import { GitTimelineProvider } from './timelineProvider';
@@ -34,8 +34,30 @@ export async function deactivate(): Promise<any> {
}
async function createModel(context: ExtensionContext, outputChannel: OutputChannel, telemetryReporter: TelemetryReporter, disposables: Disposable[]): Promise<Model> {
const pathHint = workspace.getConfiguration('git').get<string | string[]>('path');
const info = await findGit(pathHint, path => outputChannel.appendLine(localize('looking', "Looking for git in: {0}", path)));
const pathValue = workspace.getConfiguration('git').get<string | string[]>('path');
let pathHints = Array.isArray(pathValue) ? pathValue : pathValue ? [pathValue] : [];
const { isTrusted, workspaceFolders = [] } = workspace;
const excludes = isTrusted ? [] : workspaceFolders.map(f => path.normalize(f.uri.fsPath).replace(/[\r\n]+$/, ''));
if (!isTrusted && pathHints.length !== 0) {
// Filter out any non-absolute paths
pathHints = pathHints.filter(p => path.isAbsolute(p));
}
const info = await findGit(pathHints, gitPath => {
outputChannel.appendLine(localize('validating', "Validating found git in: {0}", gitPath));
if (excludes.length === 0) {
return true;
}
const normalized = path.normalize(gitPath).replace(/[\r\n]+$/, '');
const skip = excludes.some(e => normalized.startsWith(e));
if (skip) {
outputChannel.appendLine(localize('skipped', "Skipped found git in: {0}", gitPath));
}
return !skip;
});
const askpass = await Askpass.create(outputChannel, context.storagePath);
disposables.push(askpass);

View File

@@ -147,23 +147,23 @@ export class Model implements IRemoteSourceProviderRegistry, IPushErrorHandlerRe
await Promise.all((workspace.workspaceFolders || []).map(async folder => {
const root = folder.uri.fsPath;
const children = await new Promise<string[]>((c, e) => fs.readdir(root, (err, r) => err ? e(err) : c(r)));
const promises = children
.filter(child => child !== '.git')
.map(child => this.openRepository(path.join(root, child)));
const subfolders = new Set(children.filter(child => child !== '.git').map(child => path.join(root, child)));
const folderConfig = workspace.getConfiguration('git', folder.uri);
const paths = folderConfig.get<string[]>('scanRepositories') || [];
const scanPaths = (workspace.isTrusted ? workspace.getConfiguration('git', folder.uri) : config).get<string[]>('scanRepositories') || [];
for (const scanPath of scanPaths) {
if (scanPath !== '.git') {
continue;
}
for (const possibleRepositoryPath of paths) {
if (path.isAbsolute(possibleRepositoryPath)) {
if (path.isAbsolute(scanPath)) {
console.warn(localize('not supported', "Absolute paths not supported in 'git.scanRepositories' setting."));
continue;
}
promises.push(this.openRepository(path.join(root, possibleRepositoryPath)));
subfolders.add(path.join(root, scanPath));
}
await Promise.all(promises);
await Promise.all([...subfolders].map(f => this.openRepository(f)));
}));
}
@@ -226,6 +226,10 @@ export class Model implements IRemoteSourceProviderRegistry, IPushErrorHandlerRe
}
private async onDidChangeVisibleTextEditors(editors: readonly TextEditor[]): Promise<void> {
if (!workspace.isTrusted) {
return;
}
const config = workspace.getConfiguration('git');
const autoRepositoryDetection = config.get<boolean | 'subFolders' | 'openEditors'>('autoRepositoryDetection');
@@ -251,20 +255,33 @@ export class Model implements IRemoteSourceProviderRegistry, IPushErrorHandlerRe
}
@sequentialize
async openRepository(path: string): Promise<void> {
if (this.getRepository(path)) {
async openRepository(repoPath: string): Promise<void> {
if (this.getRepository(repoPath)) {
return;
}
const config = workspace.getConfiguration('git', Uri.file(path));
const config = workspace.getConfiguration('git', Uri.file(repoPath));
const enabled = config.get<boolean>('enabled') === true;
if (!enabled) {
return;
}
if (!workspace.isTrusted) {
// Check if the folder is a bare repo: if it has a file named HEAD && `rev-parse --show -cdup` is empty
try {
fs.accessSync(path.join(repoPath, 'HEAD'), fs.constants.F_OK);
const result = await this.git.exec(repoPath, ['-C', repoPath, 'rev-parse', '--show-cdup'], { log: false });
if (result.stderr.trim() === '' && result.stdout.trim() === '') {
return;
}
} catch {
// If this throw, we should be good to open the repo (e.g. HEAD doesn't exist)
}
}
try {
const rawRoot = await this.git.getRepositoryRoot(path);
const rawRoot = await this.git.getRepositoryRoot(repoPath);
// This can happen whenever `path` has the wrong case sensitivity in
// case insensitive file systems
@@ -286,7 +303,7 @@ export class Model implements IRemoteSourceProviderRegistry, IPushErrorHandlerRe
await repository.status();
} catch (ex) {
// noop
this.outputChannel.appendLine(`Opening repository for path='${path}' failed; ex=${ex}`);
this.outputChannel.appendLine(`Opening repository for path='${repoPath}' failed; ex=${ex}`);
}
}

View File

@@ -936,7 +936,16 @@ export class Repository implements Disposable {
this.disposables.push(this.workingTreeGroup);
this.disposables.push(this.untrackedGroup);
this.disposables.push(new AutoFetcher(this, globalState));
// Don't allow auto-fetch in untrusted workspaces
if (workspace.isTrusted) {
this.disposables.push(new AutoFetcher(this, globalState));
} else {
const trustDisposable = workspace.onDidGrantWorkspaceTrust(() => {
trustDisposable.dispose();
this.disposables.push(new AutoFetcher(this, globalState));
});
this.disposables.push(trustDisposable);
}
// https://github.com/microsoft/vscode/issues/39039
const onSuccessfulPush = filterEvent(this.onDidRunOperation, e => e.operation === Operation.Push && !e.error);
@@ -1847,6 +1856,7 @@ export class Repository implements Disposable {
this._submodules = submodules!;
this.rebaseCommit = rebaseCommit;
const untrackedChanges = scopedConfig.get<'mixed' | 'separate' | 'hidden'>('untrackedChanges');
const index: Resource[] = [];
const workingTree: Resource[] = [];
@@ -1905,6 +1915,9 @@ export class Repository implements Disposable {
// set count badge
this.setCountBadge();
// Update context key with changed resources
commands.executeCommand('setContext', 'git.changedResources', [...merge, ...index, ...workingTree, ...untracked].map(r => r.resourceUri.fsPath.toString()));
this._onDidChangeStatus.fire();
this._sourceControl.commitTemplate = await this.getInputTemplate();

View File

@@ -36,72 +36,11 @@
resolved "https://registry.yarnpkg.com/@types/which/-/which-1.0.28.tgz#016e387629b8817bed653fe32eab5d11279c8df6"
integrity sha1-AW44dim4gXvtZT/jLqtdESecjfY=
applicationinsights@1.7.4:
version "1.7.4"
resolved "https://registry.yarnpkg.com/applicationinsights/-/applicationinsights-1.7.4.tgz#e7d96435594d893b00cf49f70a5927105dbb8749"
integrity sha512-XFLsNlcanpjFhHNvVWEfcm6hr7lu9znnb6Le1Lk5RE03YUV9X2B2n2MfM4kJZRrUdV+C0hdHxvWyv+vWoLfY7A==
dependencies:
cls-hooked "^4.2.2"
continuation-local-storage "^3.2.1"
diagnostic-channel "0.2.0"
diagnostic-channel-publishers "^0.3.3"
async-hook-jl@^1.7.6:
version "1.7.6"
resolved "https://registry.yarnpkg.com/async-hook-jl/-/async-hook-jl-1.7.6.tgz#4fd25c2f864dbaf279c610d73bf97b1b28595e68"
integrity sha512-gFaHkFfSxTjvoxDMYqDuGHlcRyUuamF8s+ZTtJdDzqjws4mCt7v0vuV79/E2Wr2/riMQgtG4/yUtXWs1gZ7JMg==
dependencies:
stack-chain "^1.3.7"
async-listener@^0.6.0:
version "0.6.10"
resolved "https://registry.yarnpkg.com/async-listener/-/async-listener-0.6.10.tgz#a7c97abe570ba602d782273c0de60a51e3e17cbc"
integrity sha512-gpuo6xOyF4D5DE5WvyqZdPA3NGhiT6Qf07l7DCB0wwDEsLvDIbCr6j9S5aj5Ch96dLace5tXVzWBZkxU/c5ohw==
dependencies:
semver "^5.3.0"
shimmer "^1.1.0"
byline@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/byline/-/byline-5.0.0.tgz#741c5216468eadc457b03410118ad77de8c1ddb1"
integrity sha1-dBxSFkaOrcRXsDQQEYrXfejB3bE=
cls-hooked@^4.2.2:
version "4.2.2"
resolved "https://registry.yarnpkg.com/cls-hooked/-/cls-hooked-4.2.2.tgz#ad2e9a4092680cdaffeb2d3551da0e225eae1908"
integrity sha512-J4Xj5f5wq/4jAvcdgoGsL3G103BtWpZrMo8NEinRltN+xpTZdI+M38pyQqhuFU/P792xkMFvnKSf+Lm81U1bxw==
dependencies:
async-hook-jl "^1.7.6"
emitter-listener "^1.0.1"
semver "^5.4.1"
continuation-local-storage@^3.2.1:
version "3.2.1"
resolved "https://registry.yarnpkg.com/continuation-local-storage/-/continuation-local-storage-3.2.1.tgz#11f613f74e914fe9b34c92ad2d28fe6ae1db7ffb"
integrity sha512-jx44cconVqkCEEyLSKWwkvUXwO561jXMa3LPjTPsm5QR22PA0/mhe33FT4Xb5y74JDvt/Cq+5lm8S8rskLv9ZA==
dependencies:
async-listener "^0.6.0"
emitter-listener "^1.1.1"
diagnostic-channel-publishers@^0.3.3:
version "0.3.5"
resolved "https://registry.yarnpkg.com/diagnostic-channel-publishers/-/diagnostic-channel-publishers-0.3.5.tgz#a84a05fd6cc1d7619fdd17791c17e540119a7536"
integrity sha512-AOIjw4T7Nxl0G2BoBPhkQ6i7T4bUd9+xvdYizwvG7vVAM1dvr+SDrcUudlmzwH0kbEwdR2V1EcnKT0wAeYLQNQ==
diagnostic-channel@0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/diagnostic-channel/-/diagnostic-channel-0.2.0.tgz#cc99af9612c23fb1fff13612c72f2cbfaa8d5a17"
integrity sha1-zJmvlhLCP7H/8TYSxy8sv6qNWhc=
dependencies:
semver "^5.3.0"
emitter-listener@^1.0.1, emitter-listener@^1.1.1:
version "1.1.2"
resolved "https://registry.yarnpkg.com/emitter-listener/-/emitter-listener-1.1.2.tgz#56b140e8f6992375b3d7cb2cab1cc7432d9632e8"
integrity sha512-Bt1sBAGFHY9DKY+4/2cV6izcKJUf5T7/gkdmkxzX/qv9CcGH8xSwVRW5mtX03SWJtRTWSOpzCuWN9rBFYZepZQ==
dependencies:
shimmer "^1.2.0"
file-type@^7.2.0:
version "7.2.0"
resolved "https://registry.yarnpkg.com/file-type/-/file-type-7.2.0.tgz#113cfed52e1d6959ab80248906e2f25a8cdccb74"
@@ -122,32 +61,10 @@ jschardet@2.3.0:
resolved "https://registry.yarnpkg.com/jschardet/-/jschardet-2.3.0.tgz#06e2636e16c8ada36feebbdc08aa34e6a9b3ff75"
integrity sha512-6I6xT7XN/7sBB7q8ObzKbmv5vN+blzLcboDE1BNEsEfmRXJValMxO6OIRT69ylPBRemS3rw6US+CMCar0OBc9g==
semver@^5.3.0:
version "5.5.0"
resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.0.tgz#dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab"
integrity sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==
semver@^5.4.1:
version "5.7.1"
resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7"
integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==
shimmer@^1.1.0, shimmer@^1.2.0:
version "1.2.1"
resolved "https://registry.yarnpkg.com/shimmer/-/shimmer-1.2.1.tgz#610859f7de327b587efebf501fb43117f9aff337"
integrity sha512-sQTKC1Re/rM6XyFM6fIAGHRPVGvyXfgzIDvzoq608vM+jeyVD0Tu1E6Np0Kc2zAIFWIj963V2800iF/9LPieQw==
stack-chain@^1.3.7:
version "1.3.7"
resolved "https://registry.yarnpkg.com/stack-chain/-/stack-chain-1.3.7.tgz#d192c9ff4ea6a22c94c4dd459171e3f00cea1285"
integrity sha1-0ZLJ/06moiyUxN1FkXHj8AzqEoU=
vscode-extension-telemetry@0.1.7:
version "0.1.7"
resolved "https://registry.yarnpkg.com/vscode-extension-telemetry/-/vscode-extension-telemetry-0.1.7.tgz#18389bc24127c89dade29cd2b71ba69a6ee6ad26"
integrity sha512-pZuZTHO9OpsrwlerOKotWBRLRYJ53DobYb7aWiRAXjlqkuqE+YJJaP+2WEy8GrLIF1EnitXTDMaTAKsmLQ5ORQ==
dependencies:
applicationinsights "1.7.4"
vscode-extension-telemetry@0.2.8:
version "0.2.8"
resolved "https://registry.yarnpkg.com/vscode-extension-telemetry/-/vscode-extension-telemetry-0.2.8.tgz#670c625c44791237c040cee2cb9f567ca34784ac"
integrity sha512-Vf52im5qzORRD2K5Ryp8PXo31YXVcJAYRSDDZGegWlt0OATOd83DYabS1U/WIq9nR5g80UQKH3+BsenhpQHUaA==
vscode-nls@^4.0.0:
version "4.0.0"