# git: Degrade gracefully when refreshing git state \(\#57292\) · gitcafe/zed

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

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

Visibility: public

Requested revision: bcfbf669bd24d167b0d9763d2c7815f218fa0dc1

Requested commit: bcfbf669bd24d167b0d9763d2c7815f218fa0dc1

Commit: bcfbf669bd24d167b0d9763d2c7815f218fa0dc1

Tree: e4863e38397b830c89a99ea3f7effac6702f6e74

Author: Cole Miller

Committer: GitHub

## Message

```
git: Degrade gracefully when refreshing git state (#57292)

This PR changes the git store's `compute_snapshot`, which runs to update
state that depends on the contents of `.git`, to degrade gracefully when
fetching individual pieces of state fails. For example, when fetching
the list of branches fails, instead of returning early from the function
(leaving the previous git state snapshot in place with stale state), we
continue with an empty list of branches. This prevents failures of
individual git commands from making the entire git UI get stuck
indefinitely.

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)
- [ ] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Closes #ISSUE

Release Notes:

- Fixed an issue where failing to fetch branches using the git CLI would
prevent other git-related state from being updated.
```

## Parents

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

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