From 3c7cbd264e4313f236dbbad13303da54c23582d9 Mon Sep 17 00:00:00 2001 From: Ladislau Szomoru <3372902+lszomoru@users.noreply.github.com> Date: Tue, 2 Jul 2024 14:50:50 +0200 Subject: [PATCH] Git - include unstaged changes when amending a commit and smart commit is enabled (#219675) --- extensions/git/src/commands.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/extensions/git/src/commands.ts b/extensions/git/src/commands.ts index a5325033e77..fb53eee2976 100644 --- a/extensions/git/src/commands.ts +++ b/extensions/git/src/commands.ts @@ -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('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 }; } }