INNER CODE UNIT · TypeScript

createGitVcsAdapter

modem-dev/hunk · packages/hunk-git/src/index.ts:347

export function createGitVcsAdapter({
  gitExecutable = "git",
}: Readonly<GitVcsAdapterOptions> = {}) {
  return {
    id: "git",
    name: "Git",
    detect: detectGitRepo,
    detectionPriority: HUNK_VCS_DETECTION_BASELINE_PRIORITY,
    history: {
      open(input, { cwd }) {
        return openGitHistory(input, { cwd, gitExecutable });
      },
      planReview(commit, _context?: unknown, options?: { parentRevisionId?: string }) {
        const parent = options?.parentRevisionId ?? commit.parentRevisionIds[0];
        if (parent && !commit.parentRevisionIds.includes(parent)) {
          throw new Error("The selected revision is not a parent of this Git commit.");
        }
        return parent

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…