diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e6d012..bd54548 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,6 +41,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p - Changes the _Reset to Commit (via Terminal)_ command to use the _reset_ Git command - Changes the _Revert Commit (via Terminal)_ command to use the _revert_ Git command - Changes all the stash commands to use the new _stash_ Git command +- Changes _Stash All Changes_ commands in the Source Control view to toggle --kee-index appropriately — closes [#698](https://github.com/eamodio/vscode-gitlens/issues/698) - Changes the _Checkout_ command on branches, commits, and tags to use the _switch_ Git command - Changes Ansible files to use document scope for code lens — thanks to [PR #813](https://github.com/eamodio/vscode-gitlens/pull/813) by Ahmadali Shafiee ([@ahmadalli](https://github.com/ahmadalli)) - Renames _Checkout_ command to _Switch_ for branches and tags for better clarity and to align with the new Git 2.23 commands diff --git a/src/commands/stashSave.ts b/src/commands/stashSave.ts index 287014e..5a54094 100644 --- a/src/commands/stashSave.ts +++ b/src/commands/stashSave.ts @@ -18,6 +18,7 @@ export interface StashSaveCommandArgs { message?: string; repoPath?: string; uris?: Uri[]; + keepStaged?: boolean; goBackCommand?: CommandQuickPickItem; } @@ -44,6 +45,11 @@ export class StashSaveCommand extends Command { args.uris = context.scmResourceStates.map(s => s.resourceUri); } else if (context.type === 'scm-groups') { args = { ...args }; + + if (!context.scmResourceGroups.some(g => g.id === 'index')) { + args.keepStaged = true; + } + args.uris = context.scmResourceGroups.reduce( (a, b) => a.concat(b.resourceStates.map(s => s.resourceUri)), [] @@ -65,7 +71,8 @@ export class StashSaveCommand extends Command { subcommand: 'push', repo: repo, message: args.message, - uris: args.uris + uris: args.uris, + flags: args.keepStaged ? ['--keep-index'] : undefined } }; return commands.executeCommand(Commands.GitCommands, gitCommandArgs);