# git_ui: Fix \`git::FileHistory\` action in diff views \(\#63539\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/e621c4f441b08fac8f270ee62699ef53af1f2922)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: e621c4f441b08fac8f270ee62699ef53af1f2922

Requested commit: e621c4f441b08fac8f270ee62699ef53af1f2922

Commit: e621c4f441b08fac8f270ee62699ef53af1f2922

Tree: a591abd7de9a1fbfe4efc1539481280094340af7

Author: Albert Bogusz

Committer: GitHub

## Message

```
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:

- [x] I've reviewed my own diff for quality, security, and reliability
- [ ] Unsafe blocks (if any) have justifying comments
- [x] The content adheres to Zed's UI standards
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

## Showcase

Left is before, right is after:


https://github.com/user-attachments/assets/39972bdf-b24f-4583-afd7-d6eb5226f50f

---

Release Notes:

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

## Parents

- [801c087af22dd189dc1aa49e2f370b4f04190b19](https://git.cafe/gitcafe/zed/commit/801c087af22dd189dc1aa49e2f370b4f04190b19?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/e621c4f441b08fac8f270ee62699ef53af1f2922?format=markdown)
