# git: Fix panic when committing from side-by-side view \(\#47425\) · gitcafe/zed

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

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

Visibility: public

Requested revision: a5eb666951fb8999fe4181d175a8c7fcdba4e6b0

Requested commit: a5eb666951fb8999fe4181d175a8c7fcdba4e6b0

Commit: a5eb666951fb8999fe4181d175a8c7fcdba4e6b0

Tree: c1d150e896ecbe073b3ce8e0c895964a1883c71f

Author: Cole Miller

Committer: GitHub

## Message

```
git: Fix panic when committing from side-by-side view (#47425)

When committing, it was possible for the left-hand side multibuffer to
get the updated base text (via the `buffer_changed_since_sync`
mechanism) without updating its diff snapshot for that buffer (via the
diff subscription), causing a mismatch between that multibuffer's diff
state and its buffer state. The fix is to ensure for inverted diffs that
we always update pull an updated diff snapshot as part of
`sync_from_buffer_changes`.

This also removes some code that we added in #44838 to sync the
left-hand side multibuffer when edits on the right-hand side invalided
diff hunks. Instead, the left-hand side will just sync the next time the
diff recalculates when this happens, and will always consider hunks from
the last diff calculation as valid--so there will be a short window
where the diff transforms and `diff_hunks_in_range` don't match between
the two sides. That's okay because we don't rely on this in the display
map--the code that translates positions between the two sides accesses
the diff's `InternalDiffHunk`s directly rather than going through a
multibuffer API.

Release Notes:

- N/A
```

## Parents

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

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