# git: Make long-running git staging snappy in git panel \(\#42149\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 00eafe63d9f1124a4f1fa4cd5fffeb2ec0a36dbe

Requested commit: 00eafe63d9f1124a4f1fa4cd5fffeb2ec0a36dbe

Commit: 00eafe63d9f1124a4f1fa4cd5fffeb2ec0a36dbe

Tree: 0eecc6d6dca43c94f5428777529fe99d378ef77f

Author: Jakub Konka

Committer: GitHub

## Message

```
git: Make long-running git staging snappy in git panel (#42149)

Previously, staging a large file in the git panel would block the UI
items until that operation finished. This is due to the fact that
staging is a git op that is locked globally by git (per repo) meaning
only one op that is modifying the git index can run at any one time. In
order to make the UI snappy while letting any pending git staging jobs
to finish in the background, we track their progress via `PendingOps`
indexed by git entry path. We have already had a concept of pending
operations however they existed at the UI layer in the `GitPanel`
abstraction. This PR moves and augments `PendingOps` into the model
`Repository` in `git_store` which seems like a more natural place for
tracking running git jobs/operations. Thanks to this, pending ops are
now stored in a `SumTree` indexed by git entry path part of the
`Repository` snapshot, which makes for efficient access from the UI.

Release Notes:

- Improved UI responsiveness when staging/unstaging large files in the
git panel
```

## Parents

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

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