Skip to content

Use cached base ref after Pull Request is merged - #866

Open
lucasec wants to merge 1 commit into
magit:mainfrom
lucasec:fix-merged-pr-diff
Open

Use cached base ref after Pull Request is merged#866
lucasec wants to merge 1 commit into
magit:mainfrom
lucasec:fix-merged-pr-diff

Conversation

@lucasec

@lucasec lucasec commented Jul 27, 2026

Copy link
Copy Markdown

Previously, when viewing a pull request merged with a merge commit, Forge would fails to calculate a diff for the changes that were merged. This prevents quickly reviewing the diff of changes that were merged by pressing "d d" on the pull request, a common and helpful workflow.

The root issue appears to be that forge--pullreq-range used by the diff commands looks at the pull request's base branch name, and compares the pull request HEAD commit to the current commit at the base branch. After the PR is merged, the merge commit will provide a common ancestor for both, leading to the empty diff.

This applies the same fix applied in commit a3cf64d to forge--insert-pullreq-commits, which uses the cached base ref retrieved from the server, which represents the commit at the base branch at the time the PR was open. This should produce consistent diffs that line up with the commits listed in the topic buffer.

Previously, when viewing a pull request merged with a merge commit,
Forge would fails to calculate a diff for the changes that were
merged. This prevents quickly reviewing the diff of changes that were
merged by pressing "d d" on the pull request, a common and helpful
workflow.

The root issue is forge--pullreq-range used by the diff commands
looks at the pull request's base branch name, and compares the pull
request HEAD commit to the *current* commit at the base branch. After
the PR is merged, the merge commit will provide a common ancestor for
both, leading to the empty diff.

This applies the same fix applied in commit a3cf64d to
forge--insert-pullreq-commits, which uses the cached base ref
retrieved from the server, which represents the commit at the base
branch *at the time the PR was open*. This should produce consistent
diffs that line up with the commits listed in the topic buffer.
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