mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-02-01 17:25:33 -05:00
Adds experimental 'Stash Changes' command
Adds experimental 'Stash Changes' to stash list Adds experimental 'Stash Unstaged Changes' to stash list
This commit is contained in:
32
src/commands/stashSave.ts
Normal file
32
src/commands/stashSave.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
'use strict';
|
||||
import { InputBoxOptions, window } from 'vscode';
|
||||
import { GitService } from '../gitService';
|
||||
import { Command, Commands } from './common';
|
||||
import { Logger } from '../logger';
|
||||
|
||||
export class StashSaveCommand extends Command {
|
||||
|
||||
constructor(private git: GitService) {
|
||||
super(Commands.StashSave);
|
||||
}
|
||||
|
||||
async execute(message?: string, unstagedOnly: boolean = false) {
|
||||
if (!this.git.config.insiders) return undefined;
|
||||
|
||||
try {
|
||||
if (message == null) {
|
||||
message = await window.showInputBox({
|
||||
prompt: `Please provide a stash message`,
|
||||
placeHolder: `Stash message`
|
||||
} as InputBoxOptions);
|
||||
if (message === undefined) return undefined;
|
||||
}
|
||||
|
||||
return await this.git.stashSave(this.git.repoPath, message, unstagedOnly);
|
||||
}
|
||||
catch (ex) {
|
||||
Logger.error(ex, 'StashSaveCommand');
|
||||
return window.showErrorMessage(`Unable to save stash. See output channel for more details`);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user