store empty deltas anyway

This commit is contained in:
Nikita Galaiko 2023-02-10 13:23:04 +01:00
parent 7fcf60a735
commit 4c5f52ee6d
No known key found for this signature in database
GPG Key ID: EBAB54E845BA519D

View File

@ -227,9 +227,6 @@ pub fn save_current_file_deltas(
file_path: &Path, file_path: &Path,
deltas: &Vec<Delta>, deltas: &Vec<Delta>,
) -> Result<(), std::io::Error> { ) -> Result<(), std::io::Error> {
if deltas.is_empty() {
Ok(())
} else {
let project_deltas_path = project_path.join(".git/gb/session/deltas"); let project_deltas_path = project_path.join(".git/gb/session/deltas");
std::fs::create_dir_all(&project_deltas_path)?; std::fs::create_dir_all(&project_deltas_path)?;
let delta_path = project_deltas_path.join(file_path); let delta_path = project_deltas_path.join(file_path);
@ -237,7 +234,6 @@ pub fn save_current_file_deltas(
let raw_deltas = serde_json::to_string(&deltas)?; let raw_deltas = serde_json::to_string(&deltas)?;
std::fs::write(delta_path, raw_deltas)?; std::fs::write(delta_path, raw_deltas)?;
Ok(()) Ok(())
}
} }
pub fn list_current_deltas(project_path: &Path) -> Result<HashMap<String, Vec<Delta>>, Error> { pub fn list_current_deltas(project_path: &Path) -> Result<HashMap<String, Vec<Delta>>, Error> {