Skip to content

git: Mark entries as pending when staging a files making the staged highlighting more "optimistic"#43434

Merged
cole-miller merged 1 commit intozed-industries:mainfrom
van-sprundel:mark-entries-as-pending-when-staging
Dec 17, 2025
Merged

git: Mark entries as pending when staging a files making the staged highlighting more "optimistic"#43434
cole-miller merged 1 commit intozed-industries:mainfrom
van-sprundel:mark-entries-as-pending-when-staging

Conversation

@van-sprundel
Copy link
Contributor

@van-sprundel van-sprundel commented Nov 24, 2025

This at least speeds it up, not sure if this would close the issue

On main (342eba6):

Screen.Recording.2025-11-24.at.22.20.41.mov

This branch:

Screen.Recording.2025-11-24.at.22.16.56.mov

Closes #26870

Release Notes:

  • Added optimistic staged hunk updating

@cla-bot
Copy link

cla-bot bot commented Nov 24, 2025

We require contributors to sign our Contributor License Agreement, and we don't have @van-sprundel on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@van-sprundel van-sprundel changed the title git: mark entries as pending when staging a files making the staged highlighting more optimistic" git: mark entries as pending when staging a files making the staged highlighting more "optimistic" Nov 24, 2025
@van-sprundel
Copy link
Contributor Author

@cla-bot check

@van-sprundel van-sprundel force-pushed the mark-entries-as-pending-when-staging branch from 85a56ae to 0486829 Compare November 24, 2025 21:20
@cla-bot
Copy link

cla-bot bot commented Nov 24, 2025

We require contributors to sign our Contributor License Agreement, and we don't have @van-sprundel on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

1 similar comment
@cla-bot
Copy link

cla-bot bot commented Nov 24, 2025

We require contributors to sign our Contributor License Agreement, and we don't have @van-sprundel on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@cla-bot
Copy link

cla-bot bot commented Nov 24, 2025

The cla-bot has been summoned, and re-checked this pull request!

@maxdeviant maxdeviant changed the title git: mark entries as pending when staging a files making the staged highlighting more "optimistic" git: Mark entries as pending when staging a files making the staged highlighting more "optimistic" Nov 24, 2025
@van-sprundel
Copy link
Contributor Author

@cla-bot check

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Nov 24, 2025
@cla-bot
Copy link

cla-bot bot commented Nov 24, 2025

The cla-bot has been summoned, and re-checked this pull request!

@van-sprundel van-sprundel force-pushed the mark-entries-as-pending-when-staging branch from 0486829 to ec007c3 Compare November 24, 2025 21:24
@van-sprundel van-sprundel force-pushed the mark-entries-as-pending-when-staging branch from ec007c3 to 933413f Compare November 24, 2025 21:25
@van-sprundel van-sprundel marked this pull request as ready for review November 24, 2025 21:31
@cole-miller
Copy link
Member

Thanks!

+1 for making this more optimistic, and I think the basic approach is right, but we can streamline the implementation a bit. The goal is to end up with a set of pending_hunks that has the same hunk ranges as the uncommitted diff, and where the new_status for each hunk is DiffHunkSecondaryStatus::SecondaryHunkRemovalPending (staging) or DiffHunkSecondaryStatus::SecondaryHunkAdditionPending (unstaging). We should be able to add a method on BufferDiff that just sets the pending hunks to this state, which should have the same effect as the stage_or_unstage_hunks call and be a bit more efficient. Would you be able to take a crack at implementing that?

@cole-miller cole-miller moved this from Community PRs to In progress in Quality Week – December 2025 Dec 16, 2025
@van-sprundel
Copy link
Contributor Author

van-sprundel commented Dec 16, 2025

Will take a look at that later today!

@cole-miller
Copy link
Member

Hi @van-sprundel, thanks for updating the PR!

I realized that the refactoring I suggested introduces a bug, where the staged status of the hunks flickers if you click the checkbox multiple times in quick succession (this is due to losing the cx.emit(BufferDiffEvent::HunksStagedOrUnstaged { .. } in fn stage_or_unstage_hunks. I think we should go back to your original approach, sorry for the confusion! Other than that I think this is good to merge.

@van-sprundel
Copy link
Contributor Author

I did notice that when you spam it, the visualization lags behind sometimes. Wondering why this makes such a difference because I wouldn't expect it to be slower

@van-sprundel van-sprundel force-pushed the mark-entries-as-pending-when-staging branch from b540c18 to 933413f Compare December 17, 2025 14:20
@van-sprundel
Copy link
Contributor Author

Reverted the commit :)

@cole-miller
Copy link
Member

Thanks!

@cole-miller cole-miller merged commit 74b4013 into zed-industries:main Dec 17, 2025
45 checks passed
@github-project-automation github-project-automation bot moved this from In progress to Done in Quality Week – December 2025 Dec 17, 2025
HactarCE pushed a commit that referenced this pull request Dec 17, 2025
…ighlighting more "optimistic" (#43434)

This at least speeds it up, not sure if this would close the issue

On main (342eba6):


https://github.com/user-attachments/assets/55d10187-b4e6-410d-9002-06509e8015c9


This branch:


https://github.com/user-attachments/assets/e9a5c14f-9694-4321-a81c-88d6f62fb342


Closes #26870

Release Notes:

- Added optimistic staged hunk updating
cole-miller added a commit that referenced this pull request Dec 18, 2025
…staged highlighting more "optimistic" (#43434)"

This reverts commit 74b4013.
cole-miller added a commit that referenced this pull request Dec 18, 2025
…staged highlighting more "optimistic"" (#45175)

Reverts #43434

This caused a regression because the additional pending hunks don't get
cleared.
cole-miller added a commit that referenced this pull request Dec 19, 2025
Relanding #43434 with an improved approach.

Release Notes:

- N/A

---------

Co-authored-by: Ramon <55579979+van-sprundel@users.noreply.github.com>
rtfeldman pushed a commit that referenced this pull request Jan 5, 2026
…ighlighting more "optimistic" (#43434)

This at least speeds it up, not sure if this would close the issue

On main (342eba6):


https://github.com/user-attachments/assets/55d10187-b4e6-410d-9002-06509e8015c9


This branch:


https://github.com/user-attachments/assets/e9a5c14f-9694-4321-a81c-88d6f62fb342


Closes #26870

Release Notes:

- Added optimistic staged hunk updating
rtfeldman pushed a commit that referenced this pull request Jan 5, 2026
…staged highlighting more "optimistic"" (#45175)

Reverts #43434

This caused a regression because the additional pending hunks don't get
cleared.
rtfeldman pushed a commit that referenced this pull request Jan 5, 2026
Relanding #43434 with an improved approach.

Release Notes:

- N/A

---------

Co-authored-by: Ramon <55579979+van-sprundel@users.noreply.github.com>
LivioGama pushed a commit to LivioGama/zed that referenced this pull request Jan 20, 2026
…ighlighting more "optimistic" (zed-industries#43434)

This at least speeds it up, not sure if this would close the issue

On main (342eba6):


https://github.com/user-attachments/assets/55d10187-b4e6-410d-9002-06509e8015c9


This branch:


https://github.com/user-attachments/assets/e9a5c14f-9694-4321-a81c-88d6f62fb342


Closes zed-industries#26870

Release Notes:

- Added optimistic staged hunk updating
LivioGama pushed a commit to LivioGama/zed that referenced this pull request Jan 20, 2026
…staged highlighting more "optimistic"" (zed-industries#45175)

Reverts zed-industries#43434

This caused a regression because the additional pending hunks don't get
cleared.
LivioGama pushed a commit to LivioGama/zed that referenced this pull request Jan 20, 2026
…stries#45278)

Relanding zed-industries#43434 with an improved approach.

Release Notes:

- N/A

---------

Co-authored-by: Ramon <55579979+van-sprundel@users.noreply.github.com>
LivioGama pushed a commit to LivioGama/zed that referenced this pull request Jan 20, 2026
…ighlighting more "optimistic" (zed-industries#43434)

This at least speeds it up, not sure if this would close the issue

On main (342eba6):


https://github.com/user-attachments/assets/55d10187-b4e6-410d-9002-06509e8015c9


This branch:


https://github.com/user-attachments/assets/e9a5c14f-9694-4321-a81c-88d6f62fb342


Closes zed-industries#26870

Release Notes:

- Added optimistic staged hunk updating
LivioGama pushed a commit to LivioGama/zed that referenced this pull request Jan 20, 2026
…staged highlighting more "optimistic"" (zed-industries#45175)

Reverts zed-industries#43434

This caused a regression because the additional pending hunks don't get
cleared.
LivioGama pushed a commit to LivioGama/zed that referenced this pull request Jan 20, 2026
…stries#45278)

Relanding zed-industries#43434 with an improved approach.

Release Notes:

- N/A

---------

Co-authored-by: Ramon <55579979+van-sprundel@users.noreply.github.com>
@esthertrapadoux esthertrapadoux moved this to 🚢 Shipped by Community in Git board Jan 20, 2026
LivioGama pushed a commit to LivioGama/zed that referenced this pull request Feb 15, 2026
…ighlighting more "optimistic" (zed-industries#43434)

This at least speeds it up, not sure if this would close the issue

On main (342eba6):


https://github.com/user-attachments/assets/55d10187-b4e6-410d-9002-06509e8015c9


This branch:


https://github.com/user-attachments/assets/e9a5c14f-9694-4321-a81c-88d6f62fb342


Closes zed-industries#26870

Release Notes:

- Added optimistic staged hunk updating
LivioGama pushed a commit to LivioGama/zed that referenced this pull request Feb 15, 2026
…staged highlighting more "optimistic"" (zed-industries#45175)

Reverts zed-industries#43434

This caused a regression because the additional pending hunks don't get
cleared.
LivioGama pushed a commit to LivioGama/zed that referenced this pull request Feb 15, 2026
…stries#45278)

Relanding zed-industries#43434 with an improved approach.

Release Notes:

- N/A

---------

Co-authored-by: Ramon <55579979+van-sprundel@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement

Projects

Status: 🚢 Shipped by Community

Development

Successfully merging this pull request may close these issues.

git: stage file obvious delay

2 participants