vscode-pull-request-github icon indicating copy to clipboard operation
vscode-pull-request-github copied to clipboard

Pull request diff shows outdated diff

Open rzhao271 opened this issue 6 months ago • 3 comments

  1. Accidentally push lines containing debug logs with the actual fix into a commit in a dev branch. Do not push.
  2. Start creating a pull request, but check the diff. Notice the debug logs are in the diff.
  3. Run git reset --soft HEAD~ in the terminal. Unstage the lines containing the debug logs using the SCM diff view.
  4. Commit with the same commit message again by pressing the up arrow in the SCM commit message inputbox to get the last message.
  5. Start creating a pull request again, but check the diff.
  6. :bug: The debug logs are still in the diff.
  7. Create a draft PR and check the diff.
  8. :bug: The debug logs are still in the diff. GitHub shows the correct diff.

GHPRI shows outdated diff relative to GitHub

rzhao271 avatar Apr 30 '25 16:04 rzhao271

This is weird. I could repro, but then after some time, with no intervention from me, it sopped reproing. We get the file contents from the built in git extension, and I think that it had stale state somehow.

alexr00 avatar May 08 '25 10:05 alexr00

Nope, issue was that the file system provider didn't show that the modified time had changed.

alexr00 avatar May 08 '25 11:05 alexr00

I can still reproduce Steps 7 and 8. The pre-PR diff is now good, but the after-PR diff still shows outdated changes.

GitHub's correct diff versus extension's incorrect diff

rzhao271 avatar Jun 03 '25 21:06 rzhao271

  1. Run git reset --soft HEAD~ in the terminal. Unstage the lines containing the debug logs using the SCM diff view.

This means that you still have the debug log changes in your workspace. You just unstaged and didn't do a checkout.

The PR diff when you create a PR shows the state of the file in your working tree on the right.

alexr00 avatar Jul 10 '25 09:07 alexr00