Files
zed/crates/git_ui
Remco Smits 57c7b10ece git_ui: Avoid cloning repository snapshot when rendering Git graph (#66180)
## Summary

While looking into some performance issues with larger repositories, I
noticed that we call the method **snapshot** inside the **commit
details** & **ref label** render function, that clones the whole
snapshot even though we only need to know the branch name. So we don't
have to own/know the whole snapshot/state, so we can avoid doing this by
using the [deref reference of the repository
snapshot](https://github.com/zed-industries/zed/blob/85813709288520354d58b89e6986f05c958810b0/crates/project/src/git_store.rs#L750-L756).

## Testing

I tested that it still shows the right branch, which it should. Because
we still point to the same value, but we just skip a clone per ref label
that is inside the git graph :).

## Self-review

- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [x] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [x] Tests cover the new or changed behavior.

Release Notes:

- Improved Git graph rendering performance by avoiding unnecessary
repository state clones.

Co-authored-by: Kirill Bulatov <kirill@zed.dev>
2026-10-26 20:16:43 +00:00
..