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(
7272 // set allow-amend to true
7373 const cmd = `${ gptcommit } config set --local allow_amend true` ;
7474 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+ }
8292 } else if ( err || stderr ) {
8393 if ( config . debug ) {
8494 channel . appendLine ( `DEBUG: gptcommit failed with error: ${ err } | ${ stderr } ` ) ;
You can’t perform that action at this time.
0 commit comments