@@ -10,7 +10,7 @@ void main() {
10
10
final dir = await git.bootstrap ();
11
11
await File (join (dir, 'commit-msg-file' )).writeAsString ('foo' );
12
12
final commits = await read (edit: 'commit-msg-file' , workingDirectory: dir);
13
- expect (commits, equals (['foo' ]));
13
+ expect (commits, equals (['foo\n ' ]));
14
14
});
15
15
16
16
test ('get edit commit message from git root' , () async {
@@ -19,7 +19,7 @@ void main() {
19
19
await Process .run ('git' , ['add' , '.' ], workingDirectory: dir);
20
20
await Process .run ('git' , ['commit' , '-m' , 'alpha' ], workingDirectory: dir);
21
21
final commits = await read (workingDirectory: dir);
22
- expect (commits, equals (['alpha' ]));
22
+ expect (commits, equals (['alpha\n\n ' ]));
23
23
});
24
24
25
25
test ('get history commit messages' , () async {
@@ -31,7 +31,7 @@ void main() {
31
31
await Process .run ('git' , ['commit' , '-m' , 'remove alpha' ],
32
32
workingDirectory: dir);
33
33
final commits = await read (workingDirectory: dir);
34
- expect (commits, equals (['remove alpha' , 'alpha' ]));
34
+ expect (commits, equals (['remove alpha\n\n ' , 'alpha\n\n ' ]));
35
35
});
36
36
37
37
test ('get edit commit message from git subdirectory' , () async {
@@ -43,7 +43,7 @@ void main() {
43
43
await Process .run ('git' , ['commit' , '-m' , 'beta' ], workingDirectory: dir);
44
44
45
45
final commits = await read (workingDirectory: dir);
46
- expect (commits, equals (['beta' ]));
46
+ expect (commits, equals (['beta\n\n ' ]));
47
47
});
48
48
49
49
test ('get edit commit message while skipping first commit' , () async {
@@ -65,6 +65,35 @@ void main() {
65
65
from: 'HEAD~2' ,
66
66
workingDirectory: dir,
67
67
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 ' ]));
69
98
});
70
99
}
0 commit comments