File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -21,11 +21,11 @@ export type ParsedPatchFileDataType = {
2121}
2222
2323export type ParsedPatchType = {
24- hash : string
25- authorName : string
26- authorEmail : string
27- date : string
28- message : string
24+ hash ? : string
25+ authorName ? : string
26+ authorEmail ? : string
27+ date ? : string
28+ message ? : string
2929 files : ParsedPatchFileDataType [ ]
3030}
3131
@@ -40,7 +40,7 @@ function parseGitPatch(patch: string) {
4040
4141 if ( ! gitPatchMetaInfo ) return null
4242
43- const parsedPatch = {
43+ const parsedPatch : ParsedPatchType = {
4444 ...gitPatchMetaInfo ,
4545 files : [ ] as ParsedPatchFileDataType [ ] ,
4646 }
@@ -149,7 +149,7 @@ function splitMetaInfo(patch: string, lines: string[]) {
149149
150150 if ( ! match2 ) return null
151151
152- const [ , authorName , , authorEmail ] = match2
152+ const [ , authorName , , authorEmail ] = match2
153153
154154 const dateLine = lines . shift ( )
155155
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ test('is a function', () => {
1717test ( 'parses a simple patch' , ( ) => {
1818 const patchResult = parse ( data [ 'one-file.patch' ] )
1919 const diffResult = parse ( data [ 'one-file-diff.patch' ] )
20+
2021 expect . assertions ( 2 )
2122
2223 const expectResultFiles = [
You can’t perform that action at this time.
0 commit comments