@@ -205,7 +205,7 @@ export async function main(config: z.infer<typeof Config>) {
205
205
206
206
207
207
let continue_commit = true ;
208
- p . note ( build_commit_string ( commit_state , config , true ) , 'Commit Preview' )
208
+ p . note ( build_commit_string ( commit_state , config , true , false ) , 'Commit Preview' )
209
209
if ( config . confirm_commit ) {
210
210
continue_commit = await p . confirm ( { message : 'Confirm Commit?' } ) as boolean ;
211
211
if ( p . isCancel ( continue_commit ) ) process . exit ( 0 )
@@ -218,14 +218,14 @@ export async function main(config: z.infer<typeof Config>) {
218
218
219
219
try {
220
220
const options = config . overrides . shell ? { shell : config . overrides . shell } : { }
221
- const output = execSync ( `git commit -m "${ build_commit_string ( commit_state , config , false ) } "` , options ) . toString ( ) . trim ( ) ;
221
+ const output = execSync ( `git commit -m "${ build_commit_string ( commit_state , config , false , true ) } "` , options ) . toString ( ) . trim ( ) ;
222
222
if ( config . print_commit_output ) p . log . info ( output )
223
223
} catch ( err ) {
224
224
p . log . error ( 'Something went wrong when committing: ' + err )
225
225
}
226
226
}
227
227
228
- function build_commit_string ( commit_state : z . infer < typeof CommitState > , config : z . infer < typeof Config > , colorize : boolean = false ) : string {
228
+ function build_commit_string ( commit_state : z . infer < typeof CommitState > , config : z . infer < typeof Config > , colorize : boolean = false , escape_quotes : boolean = false ) : string {
229
229
let commit_string = '' ;
230
230
if ( commit_state . type ) {
231
231
commit_string += colorize ? color . blue ( commit_state . type ) : commit_state . type
@@ -295,6 +295,10 @@ function build_commit_string(commit_state: z.infer<typeof CommitState>, config:
295
295
commit_string += colorize ? `\n\n${ color . reset ( commit_state . closes ) } ${ color . magenta ( commit_state . ticket ) } ` : `\n\n${ commit_state . closes } ${ commit_state . ticket } ` ;
296
296
}
297
297
298
+ if ( escape_quotes ) {
299
+ commit_string = commit_string . replaceAll ( '"' , '\\"' )
300
+ }
301
+
298
302
return commit_string ;
299
303
}
300
304
0 commit comments