import { array } from 'get-stream' import gitLogParser, { type Commit } from 'git-log-parser' import { execAsync } from '#/src/utils/exec-async.js' export async function getCommit(hash: string): Promise { Object.assign(gitLogParser.fields, { hash: 'H', message: 'B', }) const result = await array( gitLogParser.parse( { _: hash, n: 1, }, { // Respect the global working directory so this command // parses commits on test repositories during tests. cwd: execAsync.contextOptions.cwd, }, ), ) return result?.[0] }