git: Show pure white space changes in word diffs (#45090)

Closes #44624

Before this change, white space would be trimmed from word diff ranges.
Users found this behavior confusing, so we're changing it to be more
inline with how GitHub treats whitespace in their word diffs.

Release Notes:

- git: Word diffs won't filter out pure whitespace diffs now
This commit is contained in:
Anthony Eid authored and GitHub committed 2025-12-17 10:52:27 +00:00
1 parent 89ce697d29
commit 2e6cb29324
3 files changed
+30 -55

No files matched your search

+9 -2
View File
@@ -2155,7 +2155,7 @@ mod tests {
let range = diff_1.inner.compare(&empty_diff.inner, &buffer).unwrap();
assert_eq!(range.to_point(&buffer), Point::new(0, 0)..Point::new(8, 0));
// Edit does not affect the diff.
// Edit does affects the diff because it recalculates word diffs.
buffer.edit_via_marked_text(
&"
one
@@ -2170,7 +2170,14 @@ mod tests {
.unindent(),
);
let diff_2 = BufferDiffSnapshot::new_sync(buffer.clone(), base_text.clone(), cx);
assert_eq!(None, diff_2.inner.compare(&diff_1.inner, &buffer));
assert_eq!(
Point::new(4, 0)..Point::new(5, 0),
diff_2
.inner
.compare(&diff_1.inner, &buffer)
.unwrap()
.to_point(&buffer)
);
// Edit turns a deletion hunk into a modification.
buffer.edit_via_marked_text(