fix: correctly compare revisions in "reuse existing view" check#104
fix: correctly compare revisions in "reuse existing view" check#104dlyongemallo merged 1 commit intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Updates Diffview’s “reuse existing view” logic to include the left/right revision endpoints in the match criteria, preventing incorrect tab reuse when the revision pair differs (e.g., --cached vs default), and adds a functional regression spec for the behavior.
Changes:
- Extend
find_existing_view()to compareleft/rightrevs in addition totoplevel,rev_arg, andpath_args. - Move the “reuse existing view” check to occur after adapter rev parsing so the computed revs are available for comparison.
- Add functional tests covering matching vs non-matching revision pairs.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| lua/diffview/lib.lua | Adds rev-aware matching for view reuse and uses adapter-derived revs during open. |
| lua/diffview/tests/functional/lib_spec.lua | Adds regression tests for find_existing_view() with differing/same rev endpoints. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
d1fea4c to
4aac03c
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
4aac03c to
ad866e1
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The reuse check in `diffview_open` ran before `diffview_options` was computed, so it could not distinguish views with different flags (e.g., `--cached` vs default). Move option computation before the check and compare left/right revisions when matching existing views. Centralise `same_rev` into `diffview.vcs.rev` so that `lib.lua` and `diff_view.lua` share a single implementation, and include `track_head` in the equality check.
ad866e1 to
d8fefa0
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
No description provided.