Fix missing hunks in project diff after revert (#25906)
Release Notes: - N/A
This commit is contained in:
parent
b774a4b8d1
commit
9e2b7bc5dc
5 changed files with 158 additions and 11 deletions
|
@ -2062,7 +2062,12 @@ impl MultiBuffer {
|
|||
if let Some(buffer_state) = buffers.get_mut(&excerpt.buffer_id) {
|
||||
buffer_state.excerpts.retain(|l| l != &excerpt.locator);
|
||||
if buffer_state.excerpts.is_empty() {
|
||||
log::debug!(
|
||||
"removing buffer and diff for buffer {}",
|
||||
excerpt.buffer_id
|
||||
);
|
||||
buffers.remove(&excerpt.buffer_id);
|
||||
self.diffs.remove(&excerpt.buffer_id);
|
||||
}
|
||||
}
|
||||
cursor.next(&());
|
||||
|
@ -2716,6 +2721,11 @@ impl MultiBuffer {
|
|||
snapshot.has_deleted_file = has_deleted_file;
|
||||
snapshot.has_conflict = has_conflict;
|
||||
|
||||
snapshot.diffs.retain(|_, _| false);
|
||||
for (id, diff) in self.diffs.iter() {
|
||||
snapshot.diffs.insert(*id, diff.diff.read(cx).snapshot(cx));
|
||||
}
|
||||
|
||||
excerpts_to_edit.sort_unstable_by_key(|(locator, _, _)| *locator);
|
||||
|
||||
let mut edits = Vec::new();
|
||||
|
@ -3476,7 +3486,10 @@ impl MultiBufferSnapshot {
|
|||
) -> impl Iterator<Item = MultiBufferDiffHunk> + '_ {
|
||||
let query_range = range.start.to_point(self)..range.end.to_point(self);
|
||||
self.lift_buffer_metadata(query_range.clone(), move |buffer, buffer_range| {
|
||||
let diff = self.diffs.get(&buffer.remote_id())?;
|
||||
let Some(diff) = self.diffs.get(&buffer.remote_id()) else {
|
||||
log::debug!("no diff found for {:?}", buffer.remote_id());
|
||||
return None;
|
||||
};
|
||||
let buffer_start = buffer.anchor_before(buffer_range.start);
|
||||
let buffer_end = buffer.anchor_after(buffer_range.end);
|
||||
Some(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue