Browse Source

Closes #698 - keeps index if not stashing staged

main
Eric Amodio 5 years ago
parent
commit
c8a3cc9494
2 changed files with 9 additions and 1 deletions
  1. +1
    -0
      CHANGELOG.md
  2. +8
    -1
      src/commands/stashSave.ts

+ 1
- 0
CHANGELOG.md View File

@ -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

+ 8
- 1
src/commands/stashSave.ts View File

@ -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<Uri[]>(
(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);

Loading…
Cancel
Save