git: Fix panic in split diff when edits cause excerpts to merge#49122
Merged
cole-miller merged 9 commits intomainfrom Feb 17, 2026
Merged
git: Fix panic in split diff when edits cause excerpts to merge#49122cole-miller merged 9 commits intomainfrom
cole-miller merged 9 commits intomainfrom
Conversation
rtfeldman
pushed a commit
that referenced
this pull request
Feb 17, 2026
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>
Member
Author
|
/cherry-pick preview |
github-actions bot
pushed a commit
that referenced
this pull request
Feb 17, 2026
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>
zed-zippy bot
added a commit
that referenced
this pull request
Feb 17, 2026
…) (cherry-pick to preview) (#49413) 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> Co-authored-by: Cole Miller <cole@zed.dev> Co-authored-by: Zed Zippy <234243425+zed-zippy[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Our strategy for keeping excerpts in sync between the two sides of the split diff is generally
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: