MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / getFileContentAtCommit

Function getFileContentAtCommit

evals/buffbench/gen-evals.ts:18–31  ·  view source on GitHub ↗
(
  repoPath: string,
  commitSha: string,
  filePath: string,
)

Source from the content-addressed store, hash-verified

16import type { EvalDataV2, EvalCommitV2, FileDiff } from './types'
17
18function getFileContentAtCommit(
19 repoPath: string,
20 commitSha: string,
21 filePath: string,
22): string {
23 try {
24 return execSync(`git show ${commitSha}:${JSON.stringify(filePath)}`, {
25 cwd: repoPath,
26 encoding: 'utf-8',
27 })
28 } catch (error) {
29 return ''
30 }
31}
32
33async function extractFileDiffsFromCommit(
34 repoPath: string,

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected