File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -336,21 +336,20 @@ export default class LandingSession extends Session {
336336 const containCVETrailer = CVE_RE . test ( originalTrailers ) ;
337337
338338 const metadata = this . metadata . trim ( ) . split ( '\n' ) ;
339+ const amended = original . slice ( 0 , - originalTrailers . length ) . trim ( ) . split ( '\n' ) ;
340+
339341 // Only keep existing trailers that we won't add ourselves
340- const shouldKeepTrailer = line =>
342+ const keptTrailers = originalTrailers . split ( '\n' ) . filter ( line =>
341343 ! ! line &&
342344 ( ! PR_RE . test ( line ) || this . backport ) &&
343345 ! BACKPORT_RE . test ( line ) &&
344- ! REVIEW_RE . test ( line ) ;
345- const amended = original . slice ( 0 , - originalTrailers . length ) . trim ( ) . split ( '\n' ) ;
346-
347- amended . push ( '' , ...originalTrailers . split ( '\n' ) . filter ( shouldKeepTrailer ) ) ;
346+ ! REVIEW_RE . test ( line ) ) ;
347+ amended . push ( '' , ...keptTrailers ) ;
348348
349349 for ( const line of metadata ) {
350- if ( originalTrailers . includes ( line ) ) {
351- cli . error ( 'Git found no trailers in the original commit message, ' +
352- `but '${ line } ' is present and should be a trailer.` ) ;
353- process . exit ( 1 ) ; // make it work with git rebase -x
350+ if ( keptTrailers . includes ( line ) ) {
351+ cli . warn ( `Found ${ line } , skipping..` ) ;
352+ continue ;
354353 }
355354
356355 if ( BACKPORT_RE . test ( line ) ) {
You can’t perform that action at this time.
0 commit comments