Change:
a new file with the following content and commit it. the file to like as follows, save it, and create a stash with it the file to like as follows, and save it the "Git: View Stash..." command and pick the created stash diff in the stash should look as follows: <img width="921" alt="image" src=""

Discussion:
return; } <del> await result.repository.popStash(result.stash.index); </del> await commands.executeCommand('workbench.action.closeActiveEditor'); <ins> await result.repository.popStash(result.stash.index); </ins> } @command('git.stashApply', { repository: true })

return; } <del> await result.repository.applyStash(result.stash.index); </del> await commands.executeCommand('workbench.action.closeActiveEditor'); <ins> await result.repository.applyStash(result.stash.index); </ins> } @command('git.stashDrop', { repository: true })

} const stashChanges = await repository.showStash(stash.index); <ins> const stashParentCommit = stash.parents.length > 0 ? stash.parents[0] : `${stash.hash}^`; </ins> if (!stashChanges || stashChanges.length === 0) { return;

const resources: { originalUri: Uri | undefined; modifiedUri: Uri | undefined }[] = []; for (const change of stashChanges) { if (change.status === Status.INDEX_ADDED) { <del> resources.push({ originalUri: undefined, modifiedUri: toGitUri(change.uri, `stash@{${stash.index}}`) }); </del> <ins> resources.push({ originalUri: undefined, modifiedUri: toGitUri(change.uri, stash.hash) }); </ins> } else if (change.status === Status.DELETED) { <del> resources.push({ originalUri: change.uri, modifiedUri: undefined }); </del> <ins> resources.push({ originalUri: toGitUri(change.uri, stashParentCommit), modifiedUri: undefined }); </ins> } else if (change.status === Status.INDEX_RENAMED) { <del> resources.push({ originalUri: change.originalUri, modifiedUri: toGitUri(change.uri, `stash@{${stash.index}}`) }); </del> <ins> resources.push({ originalUri: toGitUri(change.originalUri, stashParentCommit), modifiedUri: toGitUri(change.uri, stash.hash) }); </ins> } else { <del> resources.push({ originalUri: change.uri, modifiedUri: toGitUri(change.uri, `stash@{${stash.index}}`) }); </del> <ins> resources.push({ originalUri: toGitUri(change.uri, stashParentCommit), modifiedUri: toGitUri(change.uri, stash.hash) }); </ins> } }

} export interface Stash { <del> index: number; description: string; branchName?: string; </del> <ins> readonly hash: string; readonly parents: string[]; readonly index: number; readonly description: string; readonly branchName?: string; </ins> } interface MutableRemote extends Remote {

} const COMMIT_FORMAT = '%H%n%aN%n%aE%n%at%n%ct%n%P%n%D%n%B'; <ins> const STASH_FORMAT = '%H%n%P%n%gd%n%gs'; </ins> export interface ICloneOptions { readonly parentPath: string;

.map(([, mode, object, stage, file]) => ({ mode, object, stage, file })); } <ins> const stashRegex = /([0-9a-f]{40})n(.*)nstash@{(d+)}n(WIPs)*on([^:]+):(.*)(?:x00)/gmi; </ins> function parseGitStashes(raw: string): Stash[] { const result: Stash[] = []; <del> const regex = /^stash@{(d+)}:(.+)$/; const descriptionRegex = /(WIPs)*on([^:]+):(.*)$/i; for (const stash of raw.split('n').filter(s => !!s)) { // Extract index and description const match = regex.exec(stash); if (!match) { continue; } const [, index, description] = match; </del> <ins> let match, hash, parents, index, wip, branchName, description; </ins> <del> // Extract branch name from description const descriptionMatch = descriptionRegex.exec(description); if (!descriptionMatch) { result.push({ index: parseInt(index), description: description.trim() }); continue; </del> <ins> do { match = stashRegex.exec(raw); if (match === null) { break; </ins> } <del> const [, wip, branchName, message] = descriptionMatch; </del> <ins> [, hash, parents, index, wip, branchName, description] = match; </ins> result.push({ <ins> hash, parents: parents.split(' '), </ins> index: parseInt(index), <del> description: wip ? `WIP (${message.trim()})` : message.trim(), branchName: branchName.trim() </del> <ins> branchName: branchName.trim(), description: wip ? `WIP (${description.trim()})` : description.trim() </ins> }); <del> } </del> <ins> } while (true); </ins> return result; }

} async showStash(index: number): Promise<Change[] | undefined> { <del> const args = ['stash', 'show', `stash@{${index}}`, '--name-status', '-z']; </del> <ins> const args = ['stash', 'show', `stash@{${index}}`, '--name-status', '-z', '-u']; </ins> try { const result = await this.exec(args);

} async getStashes(): Promise<Stash[]> { <del> const result = await this.exec(['stash', 'list']); </del> <ins> const result = await this.exec(['stash', 'list', `--format=${STASH_FORMAT}`, '-z']); </ins> return parseGitStashes(result.stdout.trim()); }