File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed
Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -64,18 +64,32 @@ function runInteractive(): void {
6464 const options = promptCommand . opts ( ) ;
6565 const config = parseConfigFile ( options . config ) ;
6666
67+ const orig = options . file
68+ ? readFileSync ( options . file , { encoding : 'utf-8' } )
69+ : '' ;
70+
71+ if (
72+ orig
73+ . split ( '\n' )
74+ . filter ( s => ! s . startsWith ( '#' ) )
75+ . join ( '\n' )
76+ . trim ( ) !== ''
77+ ) {
78+ process . exitCode = 0 ;
79+ return ;
80+ }
81+
6782 createCommitMessage ( config )
6883 . then ( msg => {
6984 const rendered = renderMessage ( msg , config ) ;
7085 if ( options . file ) {
71- let orig = readFileSync ( options . file , { encoding : 'utf-8' } )
86+ const comments = orig
7287 . split ( '\n' )
7388 . filter ( s => s . startsWith ( '#' ) )
7489 . join ( '\n' ) ;
75-
7690 return promises . writeFile (
7791 options . file ,
78- rendered + '\n\n' + orig ,
92+ rendered + '\n\n' + comments ,
7993 {
8094 encoding : 'utf-8' ,
8195 }
You can’t perform that action at this time.
0 commit comments