Fix staging and unstaging of added and deleted files (#25631)
* When staging in a buffer whose file has been deleted, do not save the file * Fix logic for writing to index when file is deleted Release Notes: - N/A
This commit is contained in:
parent
33754f8eac
commit
ebccef1aa4
6 changed files with 88 additions and 48 deletions
|
@ -1071,7 +1071,13 @@ impl Repository {
|
|||
};
|
||||
let project_path = (self.worktree_id, path).into();
|
||||
if let Some(buffer) = buffer_store.get_by_path(&project_path, cx) {
|
||||
save_futures.push(buffer_store.save_buffer(buffer, cx));
|
||||
if buffer
|
||||
.read(cx)
|
||||
.file()
|
||||
.map_or(false, |file| file.disk_state().exists())
|
||||
{
|
||||
save_futures.push(buffer_store.save_buffer(buffer, cx));
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -1110,7 +1116,13 @@ impl Repository {
|
|||
};
|
||||
let project_path = (self.worktree_id, path).into();
|
||||
if let Some(buffer) = buffer_store.get_by_path(&project_path, cx) {
|
||||
save_futures.push(buffer_store.save_buffer(buffer, cx));
|
||||
if buffer
|
||||
.read(cx)
|
||||
.file()
|
||||
.map_or(false, |file| file.disk_state().exists())
|
||||
{
|
||||
save_futures.push(buffer_store.save_buffer(buffer, cx));
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue