mirror of
https://github.com/Microsoft/vscode
synced 2024-10-30 04:17:37 +00:00
🎨 git.ignoreLegacyWarning
This commit is contained in:
parent
09400d8073
commit
85b04dc330
3 changed files with 37 additions and 23 deletions
|
@ -613,6 +613,11 @@
|
||||||
],
|
],
|
||||||
"description": "%config.checkoutType%",
|
"description": "%config.checkoutType%",
|
||||||
"default": "all"
|
"default": "all"
|
||||||
|
},
|
||||||
|
"git.ignoreLegacyWarning": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "%config.ignoreLegacyWarning%",
|
||||||
|
"default": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,5 +35,6 @@
|
||||||
"config.enableLongCommitWarning": "Whether long commit messages should be warned about",
|
"config.enableLongCommitWarning": "Whether long commit messages should be warned about",
|
||||||
"config.confirmSync": "Confirm before synchronizing git repositories",
|
"config.confirmSync": "Confirm before synchronizing git repositories",
|
||||||
"config.countBadge": "Controls the git badge counter",
|
"config.countBadge": "Controls the git badge counter",
|
||||||
"config.checkoutType": "Controls what type of branches are listed"
|
"config.checkoutType": "Controls what type of branches are listed",
|
||||||
|
"config.ignoreLegacyWarning": "Ignores the legacy Git warning"
|
||||||
}
|
}
|
|
@ -6,7 +6,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import { ExtensionContext, workspace, window, Disposable, commands, Uri } from 'vscode';
|
import { ExtensionContext, workspace, window, Disposable, commands, Uri } from 'vscode';
|
||||||
import { findGit, Git } from './git';
|
import { findGit, Git, IGit } from './git';
|
||||||
import { Model } from './model';
|
import { Model } from './model';
|
||||||
import { GitSCMProvider } from './scmProvider';
|
import { GitSCMProvider } from './scmProvider';
|
||||||
import { CommandCenter } from './commands';
|
import { CommandCenter } from './commands';
|
||||||
|
@ -65,11 +65,29 @@ async function init(context: ExtensionContext, disposables: Disposable[]): Promi
|
||||||
model
|
model
|
||||||
);
|
);
|
||||||
|
|
||||||
const IgnoreOldGitStorageKey = 'settings.extension.git.ignoreOld';
|
await checkGitVersion(info);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function activate(context: ExtensionContext): any {
|
||||||
|
const disposables: Disposable[] = [];
|
||||||
|
context.subscriptions.push(new Disposable(() => Disposable.from(...disposables).dispose()));
|
||||||
|
|
||||||
|
init(context, disposables)
|
||||||
|
.catch(err => console.error(err));
|
||||||
|
}
|
||||||
|
|
||||||
|
async function checkGitVersion(info: IGit): Promise<void> {
|
||||||
|
const config = workspace.getConfiguration('git');
|
||||||
|
const shouldIgnore = config.get<boolean>('ignoreLegacyWarning') === true;
|
||||||
|
|
||||||
|
if (shouldIgnore) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!/^[01]/.test(info.version)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Check user setting to show older version message
|
|
||||||
if (!context.globalState.get(IgnoreOldGitStorageKey)) {
|
|
||||||
if (/^[01]/.test(info.version)) {
|
|
||||||
const update = localize('updateGit', "Update Git");
|
const update = localize('updateGit', "Update Git");
|
||||||
const neverShowAgain = localize('neverShowAgain', "Don't show again");
|
const neverShowAgain = localize('neverShowAgain', "Don't show again");
|
||||||
|
|
||||||
|
@ -82,16 +100,6 @@ async function init(context: ExtensionContext, disposables: Disposable[]): Promi
|
||||||
if (choice === update) {
|
if (choice === update) {
|
||||||
commands.executeCommand('vscode.open', Uri.parse('https://git-scm.com/'));
|
commands.executeCommand('vscode.open', Uri.parse('https://git-scm.com/'));
|
||||||
} else if (choice === neverShowAgain) {
|
} else if (choice === neverShowAgain) {
|
||||||
context.globalState.update(IgnoreOldGitStorageKey, true);
|
await config.update('ignoreLegacyWarning', true, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function activate(context: ExtensionContext): any {
|
|
||||||
const disposables: Disposable[] = [];
|
|
||||||
context.subscriptions.push(new Disposable(() => Disposable.from(...disposables).dispose()));
|
|
||||||
|
|
||||||
init(context, disposables)
|
|
||||||
.catch(err => console.error(err));
|
|
||||||
}
|
|
Loading…
Reference in a new issue