@@ -52,13 +52,14 @@ var parseRawCommit = function(raw) {
5252
5353 if ( ! match || ! match [ 1 ] || ! match [ 3 ] ) {
5454 warn ( 'Incorrect message: %s %s' , msg . hash , msg . subject ) ;
55- return null ;
55+ msg . type = 'other' ;
56+ msg . component = 'other' ;
57+ } else {
58+ msg . type = match [ 1 ] ;
59+ msg . component = match [ 2 ] ;
60+ msg . subject = match [ 3 ] ;
5661 }
5762
58- msg . type = match [ 1 ] ;
59- msg . component = match [ 2 ] ;
60- msg . subject = match [ 3 ] ;
61-
6263 return msg ;
6364} ;
6465
@@ -86,18 +87,21 @@ var currentDate = function() {
8687var printSection = function ( stream , title , section , printCommitLinks ) {
8788 printCommitLinks = printCommitLinks === undefined ? true : printCommitLinks ;
8889 var components = Object . getOwnPropertyNames ( section ) . sort ( ) ;
90+ var buffer = '' ;
91+ var sectionIsEmpty = true ;
8992
90- if ( ! components . length ) return ;
91-
92- stream . write ( util . format ( '\n## %s\n\n' , title ) ) ;
93+ var write = function ( str ) {
94+ buffer += str ;
95+ sectionIsEmpty = false ;
96+ }
9397
9498 components . forEach ( function ( name ) {
9599 var prefix = '-' ;
96100 var nested = section [ name ] . length > 1 ;
97101
98102 if ( name !== EMPTY_COMPONENT ) {
99103 if ( nested ) {
100- stream . write ( util . format ( '- **%s:**\n' , name ) ) ;
104+ write ( util . format ( '- **%s:**\n' , name ) ) ;
101105 prefix = ' -' ;
102106 } else {
103107 prefix = util . format ( '- **%s:**' , name ) ;
@@ -106,17 +110,24 @@ var printSection = function(stream, title, section, printCommitLinks) {
106110
107111 section [ name ] . forEach ( function ( commit ) {
108112 if ( printCommitLinks ) {
109- stream . write ( util . format ( '%s %s\n (%s' , prefix , commit . subject , linkToCommit ( commit . hash ) ) ) ;
113+ write ( util . format ( '%s %s\n (%s' , prefix , commit . subject , linkToCommit ( commit . hash ) ) ) ;
110114 if ( commit . closes . length ) {
111- stream . write ( ',\n ' + commit . closes . map ( linkToIssue ) . join ( ', ' ) ) ;
115+ write ( ',\n ' + commit . closes . map ( linkToIssue ) . join ( ', ' ) ) ;
112116 }
113- stream . write ( ')\n' ) ;
117+ write ( ')\n' ) ;
114118 } else {
115- stream . write ( util . format ( '%s %s\n' , prefix , commit . subject ) ) ;
119+ write ( util . format ( '%s %s\n' , prefix , commit . subject ) ) ;
116120 }
117121 } ) ;
118122 } ) ;
119123
124+ if ( sectionIsEmpty ) {
125+ // Nothing in this section. Skip.
126+ return ;
127+ }
128+
129+ stream . write ( util . format ( '\n## %s\n\n' , title ) ) ;
130+ stream . write ( buffer ) ;
120131 stream . write ( '\n' ) ;
121132} ;
122133
@@ -145,7 +156,8 @@ var writeChangelog = function(stream, commits, version) {
145156 fix : { } ,
146157 feat : { } ,
147158 perf : { } ,
148- breaks : { }
159+ breaks : { } ,
160+ other : { }
149161 } ;
150162
151163 sections . breaks [ EMPTY_COMPONENT ] = [ ] ;
@@ -173,6 +185,7 @@ var writeChangelog = function(stream, commits, version) {
173185 printSection ( stream , 'Features' , sections . feat ) ;
174186 printSection ( stream , 'Performance Improvements' , sections . perf ) ;
175187 printSection ( stream , 'Breaking Changes' , sections . breaks , false ) ;
188+ printSection ( stream , 'Other (malformed commit messages)' , sections . other ) ;
176189} ;
177190
178191
0 commit comments