mirror of
https://github.com/Microsoft/vscode
synced 2024-10-02 09:18:59 +00:00
This reverts commit 5422f5f940
.
This commit is contained in:
parent
85f13f93f1
commit
64c1b1cc60
|
@ -2103,38 +2103,36 @@ export class CommandCenter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!opts.amend) {
|
// no changes, and the user has not configured to commit all in this case
|
||||||
// no changes, and the user has not configured to commit all in this case
|
if (!noUnstagedChanges && noStagedChanges && !enableSmartCommit && !opts.all) {
|
||||||
if (!noUnstagedChanges && noStagedChanges && !enableSmartCommit && !opts.all) {
|
const suggestSmartCommit = config.get<boolean>('suggestSmartCommit') === true;
|
||||||
const suggestSmartCommit = config.get<boolean>('suggestSmartCommit') === true;
|
|
||||||
|
|
||||||
if (!suggestSmartCommit) {
|
if (!suggestSmartCommit) {
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
// prompt the user if we want to commit all or not
|
|
||||||
const message = l10n.t('There are no staged changes to commit.\n\nWould you like to stage all your changes and commit them directly?');
|
|
||||||
const yes = l10n.t('Yes');
|
|
||||||
const always = l10n.t('Always');
|
|
||||||
const never = l10n.t('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;
|
|
||||||
} else if (pick !== yes) {
|
|
||||||
return; // do not commit on cancel
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opts.all === undefined) {
|
// prompt the user if we want to commit all or not
|
||||||
opts = { ...opts, all: noStagedChanges };
|
const message = l10n.t('There are no staged changes to commit.\n\nWould you like to stage all your changes and commit them directly?');
|
||||||
} else if (!opts.all && noStagedChanges) {
|
const yes = l10n.t('Yes');
|
||||||
opts = { ...opts, all: true };
|
const always = l10n.t('Always');
|
||||||
|
const never = l10n.t('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;
|
||||||
|
} else if (pick !== yes) {
|
||||||
|
return; // do not commit on cancel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (opts.all === undefined) {
|
||||||
|
opts = { ...opts, all: noStagedChanges };
|
||||||
|
} else if (!opts.all && noStagedChanges) {
|
||||||
|
opts = { ...opts, all: true };
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// enable signing of commits if configured
|
// enable signing of commits if configured
|
||||||
|
|
Loading…
Reference in a new issue