Skip to content

Commit 64c1b1c

Browse files
authored
Revert "Git - do not show smart commit dialog when using Commit (Amend) (microsoft#214595)" (microsoft#218377)
This reverts commit 5422f5f.
1 parent 85f13f9 commit 64c1b1c

File tree

1 file changed

+25
-27
lines changed

1 file changed

+25
-27
lines changed

extensions/git/src/commands.ts

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2103,38 +2103,36 @@ export class CommandCenter {
21032103
}
21042104
}
21052105

2106-
if (!opts.amend) {
2107-
// no changes, and the user has not configured to commit all in this case
2108-
if (!noUnstagedChanges && noStagedChanges && !enableSmartCommit && !opts.all) {
2109-
const suggestSmartCommit = config.get<boolean>('suggestSmartCommit') === true;
2106+
// no changes, and the user has not configured to commit all in this case
2107+
if (!noUnstagedChanges && noStagedChanges && !enableSmartCommit && !opts.all) {
2108+
const suggestSmartCommit = config.get<boolean>('suggestSmartCommit') === true;
21102109

2111-
if (!suggestSmartCommit) {
2112-
return;
2113-
}
2114-
2115-
// prompt the user if we want to commit all or not
2116-
const message = l10n.t('There are no staged changes to commit.\n\nWould you like to stage all your changes and commit them directly?');
2117-
const yes = l10n.t('Yes');
2118-
const always = l10n.t('Always');
2119-
const never = l10n.t('Never');
2120-
const pick = await window.showWarningMessage(message, { modal: true }, yes, always, never);
2121-
2122-
if (pick === always) {
2123-
config.update('enableSmartCommit', true, true);
2124-
} else if (pick === never) {
2125-
config.update('suggestSmartCommit', false, true);
2126-
return;
2127-
} else if (pick !== yes) {
2128-
return; // do not commit on cancel
2129-
}
2110+
if (!suggestSmartCommit) {
2111+
return;
21302112
}
21312113

2132-
if (opts.all === undefined) {
2133-
opts = { ...opts, all: noStagedChanges };
2134-
} else if (!opts.all && noStagedChanges) {
2135-
opts = { ...opts, all: true };
2114+
// prompt the user if we want to commit all or not
2115+
const message = l10n.t('There are no staged changes to commit.\n\nWould you like to stage all your changes and commit them directly?');
2116+
const yes = l10n.t('Yes');
2117+
const always = l10n.t('Always');
2118+
const never = l10n.t('Never');
2119+
const pick = await window.showWarningMessage(message, { modal: true }, yes, always, never);
2120+
2121+
if (pick === always) {
2122+
config.update('enableSmartCommit', true, true);
2123+
} else if (pick === never) {
2124+
config.update('suggestSmartCommit', false, true);
2125+
return;
2126+
} else if (pick !== yes) {
2127+
return; // do not commit on cancel
21362128
}
21372129
}
2130+
2131+
if (opts.all === undefined) {
2132+
opts = { ...opts, all: noStagedChanges };
2133+
} else if (!opts.all && noStagedChanges) {
2134+
opts = { ...opts, all: true };
2135+
}
21382136
}
21392137

21402138
// enable signing of commits if configured

0 commit comments

Comments
 (0)