Skip to content

fix: correctly compare revisions in "reuse existing view" check#104

Merged
dlyongemallo merged 1 commit intomainfrom
compare_revs
Apr 13, 2026
Merged

fix: correctly compare revisions in "reuse existing view" check#104
dlyongemallo merged 1 commit intomainfrom
compare_revs

Conversation

@dlyongemallo
Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings April 13, 2026 06:00
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 compare left/right revs in addition to toplevel, rev_arg, and path_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.

Comment thread lua/diffview/lib.lua Outdated
Comment thread lua/diffview/lib.lua
Comment thread lua/diffview/tests/functional/lib_spec.lua Outdated
Comment thread lua/diffview/tests/functional/lib_spec.lua Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread lua/diffview/lib.lua Outdated
Comment thread lua/diffview/lib.lua Outdated
Comment thread lua/diffview/lib.lua Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread lua/diffview/lib.lua Outdated
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.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread lua/diffview/lib.lua
@dlyongemallo dlyongemallo merged commit 9f1b88e into main Apr 13, 2026
6 checks passed
@dlyongemallo dlyongemallo deleted the compare_revs branch April 13, 2026 07:02
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.

2 participants