Skip to content

Commit b4e1272

Browse files
committed
chore: add PersonLine type for parsePersonLine
1 parent cff39a2 commit b4e1272

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/proxy/processors/push-action/parsePush.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import zlib from 'zlib';
33
import fs from 'fs';
44
import path from 'path';
55
import lod from 'lodash';
6-
import { CommitContent } from '../types';
6+
import { CommitContent, PersonLine } from '../types';
77
import {
88
BRANCH_PREFIX,
99
EMPTY_COMMIT_HASH,
@@ -108,7 +108,7 @@ async function exec(req: any, action: Action): Promise<Action> {
108108
* @param {string} line - The line to parse.
109109
* @return {Object} An object containing the name, email, and timestamp.
110110
*/
111-
const parsePersonLine = (line: string): { name: string; email: string; timestamp: string } | null => {
111+
const parsePersonLine = (line: string): PersonLine => {
112112
const personRegex = /^(.*?) <(.*?)> (\d+) ([+-]\d+)$/;
113113
const match = line.match(personRegex);
114114
if (!match) {
@@ -126,8 +126,8 @@ const getParsedData = (headerLines: string[]) => {
126126
const parsedData: {
127127
tree?: string;
128128
parents: string[];
129-
authorInfo?: ReturnType<typeof parsePersonLine>;
130-
committerInfo?: ReturnType<typeof parsePersonLine>;
129+
authorInfo?: PersonLine;
130+
committerInfo?: PersonLine;
131131
} = { parents: [] };
132132

133133
for (const line of headerLines) {

src/proxy/processors/types.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,9 @@ export type CommitContent = {
1818
objectRef: any;
1919
content: string;
2020
}
21+
22+
export type PersonLine = {
23+
name: string;
24+
email: string;
25+
timestamp: string;
26+
}

0 commit comments

Comments
 (0)