@@ -35,6 +35,7 @@ export class StashApplyCommand extends Command {
3535
3636 async execute ( args : StashApplyCommandArgs = { confirm : true , deleteAfter : false } ) {
3737 args = { ...args } ;
38+
3839 if ( args . stashItem === undefined || args . stashItem . stashName === undefined ) {
3940 let goBackToRepositoriesCommand : CommandQuickPickItem | undefined ;
4041
@@ -52,20 +53,29 @@ export class StashApplyCommand extends Command {
5253 repoPath = pick . repoPath ;
5354 }
5455
55- const stash = await this . git . getStashList ( repoPath ) ;
56- if ( stash === undefined ) return window . showInformationMessage ( `There are no stashed changes` ) ;
56+ const progressCancellation = StashListQuickPick . showProgress ( 'apply' ) ;
5757
58- const currentCommand = new CommandQuickPickItem ( {
59- label : `go back ${ GlyphChars . ArrowBack } ` ,
60- description : `${ Strings . pad ( GlyphChars . Dash , 2 , 3 ) } to apply stashed changes`
61- } , Commands . StashApply , [ args ] ) ;
58+ try {
59+ const stash = await this . git . getStashList ( repoPath ) ;
60+ if ( stash === undefined ) return window . showInformationMessage ( `There are no stashed changes` ) ;
6261
63- const pick = await StashListQuickPick . show ( this . git , stash , 'apply' , goBackToRepositoriesCommand || args . goBackCommand , currentCommand ) ;
64- if ( pick instanceof CommandQuickPickItem ) return pick . execute ( ) ;
65- if ( pick === undefined ) return args . goBackCommand === undefined ? undefined : args . goBackCommand . execute ( ) ;
62+ if ( progressCancellation . token . isCancellationRequested ) return undefined ;
6663
67- args . goBackCommand = currentCommand ;
68- args . stashItem = pick . commit as GitStashCommit ;
64+ const currentCommand = new CommandQuickPickItem ( {
65+ label : `go back ${ GlyphChars . ArrowBack } ` ,
66+ description : `${ Strings . pad ( GlyphChars . Dash , 2 , 3 ) } to apply stashed changes`
67+ } , Commands . StashApply , [ args ] ) ;
68+
69+ const pick = await StashListQuickPick . show ( this . git , stash , 'apply' , progressCancellation , goBackToRepositoriesCommand || args . goBackCommand , currentCommand ) ;
70+ if ( pick instanceof CommandQuickPickItem ) return pick . execute ( ) ;
71+ if ( pick === undefined ) return args . goBackCommand === undefined ? undefined : args . goBackCommand . execute ( ) ;
72+
73+ args . goBackCommand = currentCommand ;
74+ args . stashItem = pick . commit as GitStashCommit ;
75+ }
76+ finally {
77+ progressCancellation . dispose ( ) ;
78+ }
6979 }
7080
7181 try {
0 commit comments