File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1939,6 +1939,17 @@ export class Repository {
19391939 return message . replace ( / ^ \s * # .* $ \n ? / gm, '' ) . trim ( ) ;
19401940 }
19411941
1942+ async getSquashMessage ( ) : Promise < string | undefined > {
1943+ const squashMsgPath = path . join ( this . repositoryRoot , '.git' , 'SQUASH_MSG' ) ;
1944+
1945+ try {
1946+ const raw = await fs . readFile ( squashMsgPath , 'utf8' ) ;
1947+ return this . stripCommitMessageComments ( raw ) ;
1948+ } catch {
1949+ return undefined ;
1950+ }
1951+ }
1952+
19421953 async getMergeMessage ( ) : Promise < string | undefined > {
19431954 const mergeMsgPath = path . join ( this . repositoryRoot , '.git' , 'MERGE_MSG' ) ;
19441955
Original file line number Diff line number Diff line change @@ -865,10 +865,10 @@ export class Repository implements Disposable {
865865 }
866866
867867 async getInputTemplate ( ) : Promise < string > {
868- const mergeMessage = await this . repository . getMergeMessage ( ) ;
868+ const commitMessage = ( await Promise . all ( [ this . repository . getMergeMessage ( ) , this . repository . getSquashMessage ( ) ] ) ) . find ( msg => msg !== undefined ) ;
869869
870- if ( mergeMessage ) {
871- return mergeMessage ;
870+ if ( commitMessage ) {
871+ return commitMessage ;
872872 }
873873
874874 return await this . repository . getCommitTemplate ( ) ;
You can’t perform that action at this time.
0 commit comments