❌

Lees weergave

nightly: git_ui: Fix `git::FileHistory` action in diff views (#63539)

Objective

The git::FileHistory action ("View File History") silently does
nothing when a diff view is the active item (single-file or multibuffer
project diff).

Solution

Diff views wrap their inner Editor and expose it via act_as, but
resolve_file_history_target used a strict active_item_as::<Editor>
downcast, which returns None for these wrappers. Resolve through
act_as instead.

Testing

Added a regression test which opens a ProjectDiff, dispatches
git::FileHistory, and asserts the file's history graph opens. I've
verified it fails without the act_as fix, and confirmed the fix
manually (see Showcase).

Self-Review Checklist:

  • I've reviewed my own diff for quality, security, and reliability
  • Unsafe blocks (if any) have justifying comments
  • The content adheres to Zed's UI standards
    (UX/UI
    and
    icon
    guidelines)
  • Tests cover the new/changed behavior
  • Performance impact has been considered and is acceptable

Showcase

Left is before, right is after:

showcase.mp4

Release Notes:

  • Fixed viewing a file's Git history when in a diff view.

  •  
❌