@@ -10,7 +10,7 @@ void main() {
1010 final dir = await git.bootstrap ();
1111 await File (join (dir, 'commit-msg-file' )).writeAsString ('foo' );
1212 final commits = await read (edit: 'commit-msg-file' , workingDirectory: dir);
13- expect (commits, equals (['foo' ]));
13+ expect (commits, equals (['foo\n ' ]));
1414 });
1515
1616 test ('get edit commit message from git root' , () async {
@@ -19,7 +19,7 @@ void main() {
1919 await Process .run ('git' , ['add' , '.' ], workingDirectory: dir);
2020 await Process .run ('git' , ['commit' , '-m' , 'alpha' ], workingDirectory: dir);
2121 final commits = await read (workingDirectory: dir);
22- expect (commits, equals (['alpha' ]));
22+ expect (commits, equals (['alpha\n\n ' ]));
2323 });
2424
2525 test ('get history commit messages' , () async {
@@ -31,7 +31,7 @@ void main() {
3131 await Process .run ('git' , ['commit' , '-m' , 'remove alpha' ],
3232 workingDirectory: dir);
3333 final commits = await read (workingDirectory: dir);
34- expect (commits, equals (['remove alpha' , 'alpha' ]));
34+ expect (commits, equals (['remove alpha\n\n ' , 'alpha\n\n ' ]));
3535 });
3636
3737 test ('get edit commit message from git subdirectory' , () async {
@@ -43,7 +43,7 @@ void main() {
4343 await Process .run ('git' , ['commit' , '-m' , 'beta' ], workingDirectory: dir);
4444
4545 final commits = await read (workingDirectory: dir);
46- expect (commits, equals (['beta' ]));
46+ expect (commits, equals (['beta\n\n ' ]));
4747 });
4848
4949 test ('get edit commit message while skipping first commit' , () async {
@@ -65,6 +65,35 @@ void main() {
6565 from: 'HEAD~2' ,
6666 workingDirectory: dir,
6767 gitLogArgs: '--skip 1' .split (' ' ));
68- expect (commits, equals (['beta' ]));
68+ expect (commits, equals (['beta\n\n ' ]));
69+ });
70+
71+ test ('get history commit messages - body contains multi lines' , () async {
72+ final bodyMultiLineMessage =
73+ '''chore(deps): bump commitlint_cli from 0.5.0 to 0.6.0
74+ Bumps [commitlint_cli](https://github.com/hyiso/commitlint) from 0.5.0 to 0.6.0.
75+ - [Release notes](https://github.com/hyiso/commitlint/releases)
76+ - [Changelog](https://github.com/hyiso/commitlint/blob/main/CHANGELOG.md)
77+ - [Commits](hyiso/[email protected] ) 78+
79+ ---
80+ updated-dependencies:
81+ - dependency-name: commitlint_cli
82+ dependency-type: direct:production
83+ update-type: version-update:semver-minor
84+ ...
85+
86+ Signed-off-by: dependabot[bot] <[email protected] >''' ;
87+ final dir = await git.bootstrap ();
88+ await File (join (dir, 'alpha.txt' )).writeAsString ('alpha' );
89+ await Process .run ('git' , ['add' , 'alpha.txt' ], workingDirectory: dir);
90+ await Process .run ('git' , ['commit' , '-m' , 'alpha' ], workingDirectory: dir);
91+ await File (join (dir, 'beta.txt' )).writeAsString ('beta' );
92+ await Process .run ('git' , ['add' , 'beta.txt' ], workingDirectory: dir);
93+ await Process .run ('git' , ['commit' , '-m' , bodyMultiLineMessage],
94+ workingDirectory: dir);
95+
96+ final commits = await read (from: 'HEAD~1' , workingDirectory: dir);
97+ expect (commits, equals (['$bodyMultiLineMessage \n\n ' ]));
6998 });
7099}
0 commit comments