Skip to content

feat: review pull requests by number - #542

Merged
esmuellert merged 1 commit into
mainfrom
feat/pull-request-review
Sep 4, 2026
Merged

feat: review pull requests by number#542
esmuellert merged 1 commit into
mainfrom
feat/pull-request-review

Conversation

@esmuellert

Copy link
Copy Markdown
Owner

Summary

Add first-class pull request review by number without checking out a branch or changing the working tree.

:CodeDiff pr 512
:CodeDiff pr 512 --remote upstream
:CodeDiff pr 512 --base release/3.x
:CodeDiff pr 512 -- lua/codediff

Changes

  • discover and fetch provider pull request refs directly through Git
    • GitHub and Azure DevOps: refs/pull/<number>/{merge,head}
    • GitLab: refs/merge-requests/<number>/{merge,head}
  • prefer the provider synthetic merge commit so its parents identify the review base and head
  • fall back to the PR head plus the remote default branch, with --base for non-default targets
  • support --remote, the existing --repo/-C override, and Git pathspecs
  • keep fetched commits under refs/codediff/pull-requests/ and force-update them after PR force-pushes
  • add explicit cache cleanup commands:
    • :CodeDiff pr clean <number>
    • :CodeDiff pr clean --all
    • both support repository selection; cleanup can be scoped with --remote
  • separate atomic Git operations from provider-specific pull request orchestration
  • document the command, ref lifecycle, supported providers, and cleanup behavior

Benefits

  • review a PR from its number with the existing merge-base Explorer
  • no checkout, local branch, worktree mutation, provider CLI, or API token required
  • works with existing Git remote authentication, including private repositories
  • supports fork workflows by selecting the target repository remote
  • cached refs remain safe for lazy/asynchronous file loading while remaining explicitly removable

Testing

  • CODEDIFF_TEST_JOBS=1 ./tests/run_tests.sh — 108 spec files passed
  • pull request integration suite — 12 tests passed against local bare remotes
  • command E2E suite — 24 tests passed
  • verified GitHub/Azure DevOps and GitLab ref layouts, merge and head fallback paths, explicit base selection, non-origin remotes, force-push updates, pathspecs, invalid/missing PRs, and branch/worktree invariants
  • verified targeted cleanup does not remove another PR, remote, or unrelated refs/codediff/* namespace
  • mutation-checked provider selection, force-update behavior, merge-base dispatch, targeted cleanup, and all-ref cleanup
  • manually opened GitHub PR fix(compact): align zero-width hunk context #512 end-to-end without checkout

@esmuellert
esmuellert requested a review from yanuoma as a code owner September 4, 2026 04:18
@esmuellert
esmuellert merged commit da93888 into main Sep 4, 2026
19 of 20 checks passed
@esmuellert
esmuellert deleted the feat/pull-request-review branch September 4, 2026 04:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant