Git - include unstaged changes when amending a commit and smart commit is enabled (#219675)

This commit is contained in:
Ladislau Szomoru 2024-07-02 14:50:50 +02:00 committed by GitHub
parent c395df82fb
commit 3c7cbd264e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2104,7 +2104,7 @@ export class CommandCenter {
}
// 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 && !opts.amend) {
const suggestSmartCommit = config.get<boolean>('suggestSmartCommit') === true;
if (!suggestSmartCommit) {
@ -2128,10 +2128,9 @@ export class CommandCenter {
}
}
if (opts.all === undefined) {
// smart commit
if (enableSmartCommit && !opts.all) {
opts = { ...opts, all: noStagedChanges };
} else if (!opts.all && noStagedChanges) {
opts = { ...opts, all: true };
}
}