File tree Expand file tree Collapse file tree 1 file changed +8
-20
lines changed Expand file tree Collapse file tree 1 file changed +8
-20
lines changed Original file line number Diff line number Diff line change @@ -83,28 +83,16 @@ export class RevertGitCommand extends QuickCommand<State> {
83
83
try {
84
84
await state . repo . git . revert ( ref . ref , state . options ) ;
85
85
} catch ( ex ) {
86
- if ( ex instanceof RevertError ) {
87
- let shouldRetry = false ;
88
- if ( ex . reason === RevertErrorReason . LocalChangesWouldBeOverwritten ) {
89
- const response = await showShouldCommitOrStashPrompt ( ) ;
90
- if ( response === 'Stash' ) {
91
- await executeCommand ( Commands . GitCommandsStashPush ) ;
92
- shouldRetry = true ;
93
- } else if ( response === 'Commit' ) {
94
- await executeCoreCommand ( 'workbench.view.scm' ) ;
95
- shouldRetry = true ;
96
- } else {
97
- continue ;
98
- }
86
+ if ( RevertError . is ( ex , RevertErrorReason . LocalChangesWouldBeOverwritten ) ) {
87
+ const response = await showShouldCommitOrStashPrompt ( ) ;
88
+ if ( response == null || response === 'Cancel' ) {
89
+ continue ;
99
90
}
100
91
101
- if ( shouldRetry ) {
102
- try {
103
- await state . repo . git . revert ( ref . ref , state . flags ) ;
104
- } catch ( ex ) {
105
- Logger . error ( ex , this . title ) ;
106
- void showGenericErrorMessage ( ex . message ) ;
107
- }
92
+ if ( response === 'Stash' ) {
93
+ await executeCommand ( Commands . GitCommandsStashPush ) ;
94
+ } else if ( response === 'Commit' ) {
95
+ await executeCoreCommand ( 'workbench.view.scm' ) ;
108
96
}
109
97
110
98
continue ;
You can’t perform that action at this time.
0 commit comments