提交 85b04dc3 编写于 作者: J Joao Moreno

🎨 git.ignoreLegacyWarning

上级 09400d80
......@@ -613,6 +613,11 @@
],
"description": "%config.checkoutType%",
"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.confirmSync": "Confirm before synchronizing git repositories",
"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"
}
\ No newline at end of file
......@@ -6,7 +6,7 @@
'use strict';
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 { GitSCMProvider } from './scmProvider';
import { CommandCenter } from './commands';
......@@ -65,27 +65,7 @@ async function init(context: ExtensionContext, disposables: Disposable[]): Promi
model
);
const IgnoreOldGitStorageKey = 'settings.extension.git.ignoreOld';
// 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 neverShowAgain = localize('neverShowAgain', "Don't show again");
const choice = await window.showWarningMessage(
localize('git20', "You seem to have git {0} installed. Code works best with git >= 2", info.version),
update,
neverShowAgain
);
if (choice === update) {
commands.executeCommand('vscode.open', Uri.parse('https://git-scm.com/'));
} else if (choice === neverShowAgain) {
context.globalState.update(IgnoreOldGitStorageKey, true);
}
}
}
await checkGitVersion(info);
}
export function activate(context: ExtensionContext): any {
......@@ -94,4 +74,32 @@ export function activate(context: ExtensionContext): any {
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;
}
const update = localize('updateGit', "Update Git");
const neverShowAgain = localize('neverShowAgain', "Don't show again");
const choice = await window.showWarningMessage(
localize('git20', "You seem to have git {0} installed. Code works best with git >= 2", info.version),
update,
neverShowAgain
);
if (choice === update) {
commands.executeCommand('vscode.open', Uri.parse('https://git-scm.com/'));
} else if (choice === neverShowAgain) {
await config.update('ignoreLegacyWarning', true, true);
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册