File tree 2 files changed +6
-3
lines changed
2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -109,9 +109,12 @@ export class GitModule {
109
109
const lastName = this . faker . person . lastName ( ) ;
110
110
const fullName = this . faker . person . fullName ( { firstName, lastName } ) ;
111
111
const username = this . faker . internet . userName ( firstName , lastName ) ;
112
- const user = this . faker . helpers . arrayElement ( [ fullName , username ] ) ;
112
+ let user = this . faker . helpers . arrayElement ( [ fullName , username ] ) ;
113
113
const email = this . faker . internet . email ( firstName , lastName ) ;
114
114
115
+ // Normalize user according to https://github.com/libgit2/libgit2/issues/5342
116
+ user = user . replace ( / ^ [ \. , : ; " \\ ' ] | [ \< \> \n ] | [ \. , : ; " \\ ' ] $ / g, '' ) ;
117
+
115
118
lines . push (
116
119
`Author: ${ user } <${ email } >` ,
117
120
`Date: ${ this . commitDate ( { refDate } ) } ` ,
Original file line number Diff line number Diff line change @@ -54,12 +54,12 @@ describe('git', () => {
54
54
expect ( parts [ 0 ] ) . toMatch ( / ^ c o m m i t [ a - f 0 - 9 ] + $ / ) ;
55
55
if ( parts . length === 7 ) {
56
56
expect ( parts [ 1 ] ) . toMatch ( / ^ M e r g e : [ a - f 0 - 9 ] + [ a - f 0 - 9 ] + $ / ) ;
57
- expect ( parts [ 2 ] ) . toMatch ( / ^ A u t h o r : [ \w _ \. ] + \< [ \w \. ] + @ [ \w \. ] + \> $ / ) ;
57
+ expect ( parts [ 2 ] ) . toMatch ( / ^ A u t h o r : [ ^ \< \> ] + \< [ \w \. ] + @ [ \w \. ] + \> $ / ) ;
58
58
expect ( parts [ 3 ] ) . toMatch ( / ^ D a t e : .+ $ / ) ;
59
59
expect ( parts [ 4 ] ) . toBe ( '' ) ;
60
60
expect ( parts [ 5 ] ) . toMatch ( / ^ \s { 4 } .+ $ / ) ;
61
61
} else {
62
- expect ( parts [ 1 ] ) . toMatch ( / ^ A u t h o r : [ \w _ \. ] + \< [ \w \. ] + @ [ \w \. ] + \> $ / ) ;
62
+ expect ( parts [ 1 ] ) . toMatch ( / ^ A u t h o r : [ ^ \< \> ] + \< [ \w \. ] + @ [ \w \. ] + \> $ / ) ;
63
63
expect ( parts [ 2 ] ) . toMatch ( / ^ D a t e : .+ $ / ) ;
64
64
expect ( parts [ 3 ] ) . toBe ( '' ) ;
65
65
expect ( parts [ 4 ] ) . toMatch ( / ^ \s { 4 } .+ $ / ) ;
You can’t perform that action at this time.
0 commit comments