# git: Optimize git HEAD state resolution \(\#59044\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 77266828984783b10bdb38866f315dc55328c06f

Requested commit: 77266828984783b10bdb38866f315dc55328c06f

Commit: 77266828984783b10bdb38866f315dc55328c06f

Tree: a543ea7f61ca314815365158075f4ec1da0a7927

Author: Lukas Geiger

Committer: GitHub

## Message

```
git: Optimize git HEAD state resolution (#59044)

Currently zed runs `git rev-parse HEAD` and `git show` sequentially to
get the git `HEAD` state in `compute_snapshot`.

`git show` already natively resolves the `HEAD` commit so we can
retrieve all info in a single process spawn which speeds things up and
removes one git background process.

Followup on #59042 in the hope to improve performance of working with
large git repos over SSH.

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

Release Notes:

- Improved performance of git HEAD state resolution

---------

Co-authored-by: Lukas Wirth <lukas@zed.dev>
```

## Parents

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

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