git: Fix buffer diff crash that could occur during the stage all operation (#47265) (cherry-pick to preview) (#47277)
zed-zippy[bot]
and
Anthony Eid
created
Cherry-pick of #47265 to preview
----
Closes https://github.com/zed-industries/zed/issues/46519
This crash happened because we were incorrectly merging pending and
unstaged hunks together by always using the pending hunk end offset as
the merged hunk bound instead of the max of both hunks.
The fix is to use `max()` when updating `buffer_offset_range.end` during
pending hunk merging, matching the behavior used for unstaged hunk
merging.
Release Notes:
- N/A
Co-authored-by: Anthony Eid <56899983+Anthony-Eid@users.noreply.github.com>