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

/**
 * Get the `git show` output for a commit
 * @param commitHash The hash of the commit to get the `git show` output for
 */
export async function getDiffForCommit(commitHash: string): Promise<string> {
  const commandsToGetDiff = ["git", "show", "-U5", commitHash];
  const diff = await getOutputFromRunningCommands(commandsToGetDiff)
  return diff;
}