File tree Expand file tree Collapse file tree 1 file changed +17
-7
lines changed Expand file tree Collapse file tree 1 file changed +17
-7
lines changed Original file line number Diff line number Diff line change @@ -72,13 +72,23 @@ export async function getCommitMessage(
72
72
// set allow-amend to true
73
73
const cmd = `${ gptcommit } config set --local allow_amend true` ;
74
74
channel . appendLine ( `COMMAND: ${ cmd } ` ) ;
75
- execSync ( cmd , { cwd : repo . rootUri . fsPath } ) ;
76
- // try again
77
- getCommitMessage ( config , repo , context , channel ) . then ( ( msg ) => {
78
- resolve ( msg ) ;
79
- } ) . catch ( ( err ) => {
80
- reject ( err ) ;
81
- } ) ;
75
+ let setAmendSuccess = true ;
76
+ try {
77
+ const setAmendOut = execSync ( cmd , { cwd : repo . rootUri . fsPath } ) . toString ( ) ;
78
+ channel . appendLine ( `STDOUT: ${ setAmendOut } ` ) ;
79
+ } catch ( error ) {
80
+ setAmendSuccess = false ;
81
+ channel . appendLine ( `ERROR: ${ error } ` ) ;
82
+ reject ( "Failed to set allow_amend to true" ) ;
83
+ }
84
+ if ( setAmendSuccess ) {
85
+ // try again
86
+ getCommitMessage ( config , repo , context , channel ) . then ( ( msg ) => {
87
+ resolve ( msg ) ;
88
+ } ) . catch ( ( err ) => {
89
+ reject ( err ) ;
90
+ } ) ;
91
+ }
82
92
} else if ( err || stderr ) {
83
93
if ( config . debug ) {
84
94
channel . appendLine ( `DEBUG: gptcommit failed with error: ${ err } | ${ stderr } ` ) ;
You can’t perform that action at this time.
0 commit comments