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:
Max Brunsfeld 2025-02-25 23:25:31 -08:00 committed by GitHub
parent 33754f8eac
commit ebccef1aa4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 88 additions and 48 deletions

View file

@ -368,6 +368,14 @@ impl DiskState {
DiskState::Deleted => None,
}
}
pub fn exists(&self) -> bool {
match self {
DiskState::New => false,
DiskState::Present { .. } => true,
DiskState::Deleted => false,
}
}
}
/// The file associated with a buffer, in the case where the file is on the local disk.