Skip to content

fix(view): don't hide work when the overview base is HEAD or unresolved - #361

Merged
dlyongemallo merged 1 commit into
mainfrom
worktree_fix_empty_panel
Oct 13, 2026
Merged

dlyongemallo merged 1 commit into
mainfrom
worktree_fix_empty_panel

Conversation

@dlyongemallo

Copy link
Copy Markdown
Owner

Fix for #334 bug.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Both new tests can pass without successfully opening the intended DiffView.

1 open finding
What changed in this PR

Prevents worktree overview navigation from hiding uncommitted changes when the comparison base equals HEAD, and warns when no base resolves.

Changes:

  • Detects when the base and HEAD reference the same commit.
  • Falls back to the default worktree view or emits an unresolved-base warning.
  • Adds functional regression tests.
File Description
worktree_overview_view.lua Handles equal or unresolved comparison bases.
worktree_overview_view_spec.lua Tests equal-HEAD and unresolved-base behavior.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +460 to +466
opened = require("diffview.lib").get_current_view()
assert.is_not_nil(opened)
assert.equals(repo, opened.adapter.ctx.toplevel)
-- `rev_arg` on a working-tree-vs-HEAD DiffView is nil / empty;
-- a `base...` form would set it to that string.
local rev_arg = opened.rev_arg
assert.is_true(rev_arg == nil or rev_arg == "")
@dlyongemallo
dlyongemallo force-pushed the worktree_fix_empty_panel branch from a880d81 to 7e269f2 Compare October 13, 2026 13:01
@dlyongemallo
dlyongemallo merged commit f3ef048 into main Oct 13, 2026
8 checks passed
@dlyongemallo
dlyongemallo deleted the worktree_fix_empty_panel branch October 13, 2026 13:03
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