Skip to content

git: Fix panic in split diff when edits cause excerpts to merge (#49122) (cherry-pick to preview)#49413

Merged
zed-zippy[bot] merged 1 commit intov0.224.xfrom
cherry-pick-v0.224.x-fefb81c0
Feb 17, 2026
Merged

git: Fix panic in split diff when edits cause excerpts to merge (#49122) (cherry-pick to preview)#49413
zed-zippy[bot] merged 1 commit intov0.224.xfrom
cherry-pick-v0.224.x-fefb81c0

Conversation

@zed-zippy
Copy link
Contributor

@zed-zippy zed-zippy bot commented Feb 17, 2026

Cherry-pick of #49122 to preview


Our strategy for keeping excerpts in sync between the two sides of the
split diff is generally

  • mutate the excerpts on the RHS
  • pull out the new excerpts for the affected path from the RHS
  • translate those ranges to the LHS
  • update the LHS excerpts with those ranges

But this can break down when the translated ranges overlap on the LHS
despite the original ranges not overlapping on the RHS. This can happen,
for example, when a large deletion in a file crosses several excerpt
boundaries. It's rare because normally excerpt boundaries in the project
diff and branch diff are adjusted to keep entire diff hunks in view, but
we defer this for dirty files, so it's not hard to trigger it when using
the agent or editing an individual file while the diff is open in
another tab.

Release Notes:

  • Fixed a panic that could occur when editing files while the project
    diff or branch diff was open.

Co-authored-by: Zed Zippy <234243425+zed-zippy[bot]@users.noreply.github.com>

Our strategy for keeping excerpts in sync between the two sides of the
split diff is generally

- mutate the excerpts on the RHS
- pull out the new excerpts for the affected path from the RHS
- translate those ranges to the LHS
- update the LHS excerpts with those ranges

But this can break down when the translated ranges overlap on the LHS
despite the original ranges not overlapping on the RHS. This can happen,
for example, when a large deletion in a file crosses several excerpt
boundaries. It's rare because normally excerpt boundaries in the project
diff and branch diff are adjusted to keep entire diff hunks in view, but
we defer this for dirty files, so it's not hard to trigger it when using
the agent or editing an individual file while the diff is open in
another tab.

Release Notes:

- Fixed a panic that could occur when editing files while the project
diff or branch diff was open.

---------

Co-authored-by: Zed Zippy <234243425+zed-zippy[bot]@users.noreply.github.com>
@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Feb 17, 2026
@zed-community-bot zed-community-bot bot added the bot Pull requests authored by a bot label Feb 17, 2026
@zed-zippy zed-zippy bot merged commit ff6a151 into v0.224.x Feb 17, 2026
35 checks passed
@zed-zippy zed-zippy bot deleted the cherry-pick-v0.224.x-fefb81c0 branch February 17, 2026 22:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot Pull requests authored by a bot cla-signed The user has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant