mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-02-01 17:25:33 -05:00
Adds go back support to stash apply, delete, & save
This commit is contained in:
@@ -3,6 +3,7 @@ import { MessageItem, window } from 'vscode';
|
||||
import { GitService } from '../gitService';
|
||||
import { Command, Commands } from './common';
|
||||
import { Logger } from '../logger';
|
||||
import { CommandQuickPickItem } from '../quickPicks';
|
||||
|
||||
export class StashDeleteCommand extends Command {
|
||||
|
||||
@@ -10,7 +11,7 @@ export class StashDeleteCommand extends Command {
|
||||
super(Commands.StashDelete);
|
||||
}
|
||||
|
||||
async execute(stashItem: { stashName: string, message: string }, confirm: boolean = true) {
|
||||
async execute(stashItem: { stashName: string, message: string }, confirm: boolean = true, goBackCommand?: CommandQuickPickItem) {
|
||||
if (!this.git.config.insiders) return undefined;
|
||||
if (!this.git.repoPath) return undefined;
|
||||
if (!stashItem || !stashItem.stashName) return undefined;
|
||||
@@ -19,7 +20,7 @@ export class StashDeleteCommand extends Command {
|
||||
if (confirm) {
|
||||
const message = stashItem.message.length > 80 ? `${stashItem.message.substring(0, 80)}\u2026` : stashItem.message;
|
||||
const result = await window.showWarningMessage(`Delete stashed changes '${message}'?`, { title: 'Yes' } as MessageItem, { title: 'No', isCloseAffordance: true } as MessageItem);
|
||||
if (!result || result.title !== 'Yes') return undefined;
|
||||
if (!result || result.title !== 'Yes') return goBackCommand && goBackCommand.execute();
|
||||
}
|
||||
|
||||
return await this.git.stashDelete(this.git.repoPath, stashItem.stashName);
|
||||
|
||||
Reference in New Issue
Block a user