INNER CODE UNIT · TypeScript
createGitSourceCapabilityAsync
modem-dev/hunk · packages/hunk-git/src/index.ts:210
async function createGitSourceCapabilityAsync(
input: GitBackedInput,
repoRoot: string,
endpoints: GitDiffEndpoints,
gitExecutable: string,
signal?: AbortSignal,
): Promise<GitSourceCapability> {
const needsIndex = endpoints.old.kind === "index" || endpoints.new.kind === "index";
const indexCacheKey = needsIndex
? await gitIndexCacheKeyAsync(input, repoRoot, gitExecutable, signal)
: "unused";
return {
sourceCacheKey: [
"git-source-v1",
gitEndpointCacheKey(endpoints.old, indexCacheKey),
gitEndpointCacheKey(endpoints.new, indexCacheKey),
].join(":"),
readFileSource: ({ path, previousPath, changeType, side }) => {