git: Move diff hunk operations onto buffer diffs (#63556)

# Objective

Keep Git-specific diff-base knowledge in `GitStore`, where Git
operations are defined.

Related to FR-135.

## Solution

Give each `BufferDiff` its supported hunk operations. Keep editor hooks
limited to rendering custom controls.

## Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content adheres to Zed's UI standards
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

---

Release Notes:

- N/A
This commit is contained in:
Ben Kunkle authored and GitHub committed 2026-09-01 15:52:33 +00:00
1 parent 99f85efa71
commit aecaacdb44
21 files changed
+501 -603

No files matched your search

+3 -7
View File
@@ -160,13 +160,9 @@ impl ActionLog {
let language = buffer.read(cx).language().cloned();
let language_registry = buffer.read(cx).language_registry();
let diff = cx.new(|cx| {
BufferDiff::new(
&text_snapshot,
language,
language_registry,
buffer_diff::DiffBaseKind::Custom,
cx,
)
let mut diff = BufferDiff::new(&text_snapshot, language, language_registry, cx);
diff.set_operations(Arc::new(buffer_diff::RestoreDiffOperations));
diff
});
let (diff_update_tx, diff_update_rx) = mpsc::unbounded();
let diff_base;