mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-21 01:25:37 -05:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user