pwntester / octo.nvim

Edit and review GitHub issues and pull requests from the comfort of your favorite editor
MIT License
2.42k stars 135 forks source link

Support proper diffing of renamed files with changes #245

Closed MattSPalmer closed 2 years ago

MattSPalmer commented 2 years ago

Issue Description

Type: feature request

Describe what happened (or what feature you want)

Github's own PR review properly represents a left/right diff for files that are known to have been renamed. e.g. when I rename index.js to index.ts (with or without git mv) and optionally make some changes, I see the before/after diff as that of a single file, as opposed to two files: one deleted, one created.

Describe what you expected to happen

Expected corresponding behavior within the Octo PR review experience.

In fact, the OctoChangedFiles buffer is aware of the rename (coding the file as R instead of M or A), probably because we're getting the changed file data direct from GitHub. Additionally, the line number highlighting on the right correctly show the changed hunks (though it includes but doesn't distinguish from the "context" lines).

But the diff itself suggests a newly created file (the left side is empty and shares the name of the buffer on the right.

How to reproduce it (as minimally and precisely as possible)

Tell us your environment

MacOS Monterey,nvim v0.6.1

Anything else we need to know?

Admittedly this may be tricky to do if git mv was not used to do the renaming. Hopefully the changed file data from GitHub is enough to hint toward the correct behavior.

pwntester commented 2 years ago

Hi, thanks for reporting. I have fixed it in #255 can you please help me test it?