Git - add option to restore staged changes when aplying/popping a stash (#278556)

This commit is contained in:
Ladislau Szomoru
2025-11-20 11:13:37 +00:00
committed by GitHub
parent 4c798ea2c6
commit 9c36e3505a
3 changed files with 20 additions and 17 deletions

View File

@@ -2461,13 +2461,19 @@ export class Repository {
}
}
async popStash(index?: number): Promise<void> {
async popStash(index?: number, options?: { reinstateStagedChanges?: boolean }): Promise<void> {
const args = ['stash', 'pop'];
if (options?.reinstateStagedChanges) {
args.push('--index');
}
await this.popOrApplyStash(args, index);
}
async applyStash(index?: number): Promise<void> {
async applyStash(index?: number, options?: { reinstateStagedChanges?: boolean }): Promise<void> {
const args = ['stash', 'apply'];
if (options?.reinstateStagedChanges) {
args.push('--index');
}
await this.popOrApplyStash(args, index);
}