# git_graph: Add remote support for commit data handler \(\#54468\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 72d004c8e8e4fd9088a9b32e63901b4a24c2ae09

Requested commit: 72d004c8e8e4fd9088a9b32e63901b4a24c2ae09

Commit: 72d004c8e8e4fd9088a9b32e63901b4a24c2ae09

Tree: a9cb610c1b386492370b97d5b745b9839945068c

Author: Anthony Eid

Committer: GitHub

## Message

```
git_graph: Add remote support for commit data handler (#54468)

### Motivation

To support remote Git graph usage, we need remote support for the Git
APIs that the graph depends on. This PR adds remote support for
`CommitDataHandler` (the `git cat-file --batch` process manager),
allowing remote Git graph consumers to fetch visible commit data without
polling.

#### Summary

The Git graph separates the UI and data layers so the UI can continue
rendering while commit data is fetched in the background. This change
extends that model to remote repositories by allowing
`GitStore::fetch_commit_data(sha: Oid, await_result: bool, cx: &mut
Context) -> &CommitDataState` to await remote commit loading.

For simplicity, the `Starting` variant was removed from
`CommitDataState`. `CommitDataState::Loading(Option<...>)` now stores
`Some(...)` when `await_result == true` is passed to
`fetch_commit_data`. This allows the data layer to await commit loading
without polling, and only when explicitly requested.

I also removed the `Graph` prefix from `CommitData`-related types
because this API is general-purpose and not limited to the graph. Longer
term, I hope to replace `Repository::show` with the commit data
functionality, since it already provides built-in caching.

#### Bug Fixes

- Fix stale `Loading(...)` entries that survive enqueue failure or
handler shutdown.
- Fix commit data handler bookkeeping so `pending_requests`,
`completion_senders`, and `CommitDataState` remain consistent.
- Fix remote commit-data loading so the data layer can await results
instead of polling.

#### Testing

- Add property tests for commit data fetching.
- Add a collab integration test that verifies batched remote commit-data
fetching.

#### Follow Up

In a follow-up, I want to replace the `Repository::show` backend with
the commit data handler and remove `CommitDetails` from the codebase as
a cleanup and maintenance pass. The commit data handler already provides
caching and is a better long-term path for commit metadata access.

I may also want to allow the `CommitData` type to propagate errors to
callers.

For the Git graph, the remaining work is remote search and initial data
fetching.

Self-Review Checklist:

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

Release Notes:

- N/A

---------

Co-authored-by: Remco Smits <djsmits12@gmail.com>
```

## Parents

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

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