mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 04:49:35 +00:00
'suggestSmartCommit' configuration setting was introduced
This commit is contained in:
parent
0f3eefc626
commit
fe6864f649
|
@ -1097,6 +1097,12 @@
|
|||
"description": "%config.enableSmartCommit%",
|
||||
"default": false
|
||||
},
|
||||
"git.suggestSmartCommit": {
|
||||
"type": "boolean",
|
||||
"scope": "resource",
|
||||
"description": "%config.suggestSmartCommit%",
|
||||
"default": true
|
||||
},
|
||||
"git.enableCommitSigning": {
|
||||
"type": "boolean",
|
||||
"scope": "resource",
|
||||
|
|
|
@ -85,6 +85,7 @@
|
|||
"config.ignoreLimitWarning": "Ignores the warning when there are too many changes in a repository.",
|
||||
"config.defaultCloneDirectory": "The default location to clone a git repository.",
|
||||
"config.enableSmartCommit": "Commit all changes when there are no staged changes.",
|
||||
"config.suggestSmartCommit": "Suggests to enable smart commit (commit all changes when there are no staged changes).",
|
||||
"config.enableCommitSigning": "Enables commit signing with GPG.",
|
||||
"config.discardAllScope": "Controls what changes are discarded by the `Discard all changes` command. `all` discards all changes. `tracked` discards only tracked files. `prompt` shows a prompt dialog every time the action is run.",
|
||||
"config.decorations.enabled": "Controls whether Git contributes colors and badges to the explorer and the open editors view.",
|
||||
|
|
|
@ -1192,14 +1192,23 @@ export class CommandCenter {
|
|||
// no changes, and the user has not configured to commit all in this case
|
||||
if (!noUnstagedChanges && noStagedChanges && !enableSmartCommit) {
|
||||
|
||||
const suggestSmartCommit = config.get<boolean>('suggestSmartCommit') === true;
|
||||
if (!suggestSmartCommit) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// prompt the user if we want to commit all or not
|
||||
const message = localize('no staged changes', "There are no staged changes to commit.\n\nWould you like to automatically stage all your changes and commit them directly?");
|
||||
const yes = localize('yes', "Yes");
|
||||
const always = localize('always', "Always");
|
||||
const pick = await window.showWarningMessage(message, { modal: true }, yes, always);
|
||||
const never = localize('never', "Never");
|
||||
const pick = await window.showWarningMessage(message, { modal: true }, yes, always, never);
|
||||
|
||||
if (pick === always) {
|
||||
config.update('enableSmartCommit', true, true);
|
||||
} else if (pick === never) {
|
||||
config.update('suggestSmartCommit', false, true);
|
||||
return false;
|
||||
} else if (pick !== yes) {
|
||||
return false; // do not commit on cancel
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue