Skip to content

Commit

Permalink
refactor: filter entries that are default log fields types
Browse files Browse the repository at this point in the history
  • Loading branch information
mcarvin8 committed Apr 7, 2024
1 parent 40ad90b commit 3308591
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/service/retrieveCommitMessages.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';
import { readFileSync } from 'node:fs';
import { simpleGit, SimpleGit, SimpleGitOptions, DefaultLogFields } from 'simple-git';
import { simpleGit, SimpleGit, SimpleGitOptions, DefaultLogFields, LogResult } from 'simple-git';

export async function retrieveCommitMessages(
fromCommit: string,
Expand All @@ -14,8 +14,10 @@ export async function retrieveCommitMessages(
trimmed: false,
};
const git: SimpleGit = simpleGit(options);
const result = await git.log({ from: fromCommit, to: toCommit, format: '%s' });
const commitMessages = (result.all as unknown as DefaultLogFields[]).map((commit) => commit.message);
const result: LogResult<string | DefaultLogFields> = await git.log({ from: fromCommit, to: toCommit, format: '%s' });

// Filter only entries that match the DefaultLogFields type
const commitMessages: string[] = (result.all as DefaultLogFields[]).map((commit) => commit.message);

let regex: RegExp;
let regexPattern = '';
Expand Down

0 comments on commit 3308591

Please sign in to comment.