浏览代码

Closes #698 - keeps index if not stashing staged

main
Eric Amodio 5 年前
父节点
当前提交
c8a3cc9494
共有 2 个文件被更改,包括 9 次插入1 次删除
  1. +1
    -0
      CHANGELOG.md
  2. +8
    -1
      src/commands/stashSave.ts

+ 1
- 0
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

+ 8
- 1
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<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);

正在加载...
取消
保存