# git: Fix race condition when \[un\]staging hunks in quick succession \(\#26422\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 00359271d11b6ba865fe81f04f675bf588a17335

Requested commit: 00359271d11b6ba865fe81f04f675bf588a17335

Commit: 00359271d11b6ba865fe81f04f675bf588a17335

Tree: dacce74506c95c6884b48bde82f9f183b44bf96d

Author: João Marcos

Committer: GitHub

## Message

```
git: Fix race condition when [un]staging hunks in quick succession (#26422)

- [x] Fix `[un]stage` hunk operations cancelling pending ones
  - [x] Add test
- [ ] bugs I stumbled upon (try to repro again before merging)
  - [x] holding `git::StageAndNext` skips hunks randomly 
    - [x] Add test
  - [x] restoring a file keeps it in the git panel
- [x] Double clicking on `toggle staged` fast makes Zed disagree with
`git` CLI
- [x] checkbox shows :heavy_check_mark: (fully staged) after a single
stage

Release Notes:

- N/A

---------

Co-authored-by: Cole <cole@zed.dev>
Co-authored-by: Max <max@zed.dev>
```

## Parents

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

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