This repository was archived by the owner on Dec 15, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -2105,6 +2105,30 @@ describe('Repository', function() {
21052105 ) ;
21062106 await assert . async . strictEqual ( repository . getCommitMessage ( ) , fs . readFileSync ( templatePath , 'utf8' ) ) ;
21072107 } ) ;
2108+ it ( 'updates commit message to empty string if commit.template is unset' , async function ( ) {
2109+ const { repository, observer, subscriptions} = await wireUpObserver ( ) ;
2110+ sub = subscriptions ;
2111+ await observer . start ( ) ;
2112+
2113+ assert . strictEqual ( repository . getCommitMessage ( ) , '' ) ;
2114+
2115+ const templatePath = path . join ( repository . getWorkingDirectoryPath ( ) , 'a.txt' ) ;
2116+ await repository . git . setConfig ( 'commit.template' , templatePath ) ;
2117+ await expectEvents (
2118+ repository ,
2119+ path . join ( '.git' , 'config' ) ,
2120+ ) ;
2121+
2122+ await assert . async . strictEqual ( repository . getCommitMessage ( ) , fs . readFileSync ( templatePath , 'utf8' ) ) ;
2123+
2124+ await repository . git . unsetConfig ( 'commit.template' ) ;
2125+
2126+ await expectEvents (
2127+ repository ,
2128+ path . join ( '.git' , 'config' ) ,
2129+ ) ;
2130+ await assert . async . strictEqual ( repository . getCommitMessage ( ) , '' ) ;
2131+ } ) ;
21082132 } ) ;
21092133
21102134 describe ( 'merge events' , function ( ) {
You can’t perform that action at this time.
0 commit comments