pr-check / src / git / getDiffsForAllCommits.ts
getDiffsForAllCommits.ts
Raw
import { getDiffForCommit } from './getDiffForCommit';

/**
 * Get the `git show` output for a series of commits.
 * @param commitHash The hash of the commit to get the `git show` output for
 * @returns An array of strings representing the `git show` output for each commit
 */
export async function getDiffsForAllCommits(commitHashes: string[]): Promise<string[]> {
  const diffs = [];
  for (const commitHash of commitHashes) {
    const diff = await getDiffForCommit(commitHash);
    diffs.push(diff);
  }
  return diffs;
}