提交 fe518b7e 编写于 作者: J Joao Moreno

git: confirmSync setting

上级 42f38e61
......@@ -397,6 +397,11 @@
"description": "%config.enableLongCommitWarning%",
"default": true
},
"git.confirmSync": {
"type": "boolean",
"description": "%config.confirmSync%",
"default": true
},
"git.countBadge": {
"type": "string",
"enum": [
......
......@@ -27,6 +27,7 @@
"config.autorefresh": "Whether auto refreshing is enabled",
"config.autofetch": "Whether auto fetching is enabled",
"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"
}
\ No newline at end of file
......@@ -461,6 +461,28 @@ export class CommandCenter {
@CommandCenter.Command('git.sync')
@CommandCenter.CatchErrors
async sync(): Promise<void> {
const HEAD = this.model.HEAD;
if (!HEAD || !HEAD.upstream) {
return;
}
const config = workspace.getConfiguration('git');
const shouldPrompt = config.get<boolean>('confirmSync') === true;
if (shouldPrompt) {
const message = localize('sync is unpredictable', "This action will push and pull commits to and from '{0}'.", HEAD.upstream);
const yes = localize('ok', "OK");
const neverAgain = localize('never again', "OK, Never Show Again");
const pick = await window.showWarningMessage(message, { modal: true }, yes, neverAgain);
if (pick === neverAgain) {
await config.update('confirmSync', false, true);
} else if (pick !== yes) {
return;
}
}
await this.model.sync();
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册