Preserve buffer identity when underlying entry temporarily disappears
This commit is contained in:
parent
0a1aea6cb8
commit
f28cc5ca0c
4 changed files with 26 additions and 14 deletions
|
@ -4298,34 +4298,35 @@ impl Project {
|
|||
return;
|
||||
}
|
||||
|
||||
let new_file = if let Some(entry) = old_file
|
||||
.entry_id
|
||||
.and_then(|entry_id| snapshot.entry_for_id(entry_id))
|
||||
let new_file = if let Some(entry) = snapshot.entry_for_id(old_file.entry_id)
|
||||
{
|
||||
File {
|
||||
is_local: true,
|
||||
entry_id: Some(entry.id),
|
||||
entry_id: entry.id,
|
||||
mtime: entry.mtime,
|
||||
path: entry.path.clone(),
|
||||
worktree: worktree_handle.clone(),
|
||||
is_deleted: false,
|
||||
}
|
||||
} else if let Some(entry) =
|
||||
snapshot.entry_for_path(old_file.path().as_ref())
|
||||
{
|
||||
File {
|
||||
is_local: true,
|
||||
entry_id: Some(entry.id),
|
||||
entry_id: entry.id,
|
||||
mtime: entry.mtime,
|
||||
path: entry.path.clone(),
|
||||
worktree: worktree_handle.clone(),
|
||||
is_deleted: false,
|
||||
}
|
||||
} else {
|
||||
File {
|
||||
is_local: true,
|
||||
entry_id: None,
|
||||
entry_id: old_file.entry_id,
|
||||
path: old_file.path().clone(),
|
||||
mtime: old_file.mtime(),
|
||||
worktree: worktree_handle.clone(),
|
||||
is_deleted: true,
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue