TestRangeDiffSurvivesExternalDiffTool covers the ModeRange call site (git diff ), which likewise must pass --no-ext-diff so that a user's external diff tool does not break range comparisons.
(t *testing.T)
| 442 | // (git diff <base> <to>), which likewise must pass --no-ext-diff so that a |
| 443 | // user's external diff tool does not break range comparisons. |
| 444 | func TestRangeDiffSurvivesExternalDiffTool(t *testing.T) { |
| 445 | repo := initRepoWithChange(t) |
| 446 | |
| 447 | // Commit the change so there is a committed delta between two refs. |
| 448 | runGitTest(t, repo, "add", "sample.txt") |
| 449 | runGitTest(t, repo, "commit", "-q", "-m", "second commit") |
| 450 | |
| 451 | garbage := writeGarbageExternalDiff(t) |
| 452 | t.Setenv("GIT_EXTERNAL_DIFF", garbage) |
| 453 | |
| 454 | runner := gitcmd.New(0) |
| 455 | // Range: HEAD~1..HEAD -> the second commit's change. |
| 456 | provider := NewProvider(repo, "HEAD~1", "HEAD", runner) |
| 457 | |
| 458 | diffs, err := provider.GetDiff(context.Background()) |
| 459 | if err != nil { |
| 460 | t.Fatalf("GetDiff (range) returned error: %v", err) |
| 461 | } |
| 462 | |
| 463 | if len(diffs) == 0 { |
| 464 | t.Fatalf("expected at least one parsed range diff with an external diff "+ |
| 465 | "tool active, got 0 -- git diff range call site must pass "+ |
| 466 | "--no-ext-diff (issue #82). GIT_EXTERNAL_DIFF=%s", garbage) |
| 467 | } |
| 468 | } |
| 469 | |
| 470 | // TestCommitDiffMergeCommitReviewsFirstParentDiff covers `ocr review --commit |
| 471 | // <merge>`: plain `git show` renders merge commits as a combined diff |
nothing calls this directly
no test coverage detected