diff --git a/pttodoest/src/main.rs b/pttodoest/src/main.rs index a1dd691..55cfeff 100755 --- a/pttodoest/src/main.rs +++ b/pttodoest/src/main.rs @@ -167,7 +167,9 @@ impl File { pub fn stage_persisted(&self) -> Result<(), String> { let persisted_as_snapshot = self.events()?.snapshot()?; - self.append(Delta::snapshot(persisted_as_snapshot.clone()))?; + if persisted_as_snapshot != self.events()?.last_snapshot() { + self.append(Delta::snapshot(persisted_as_snapshot.clone()))?; + } let plaintext = serde_yaml::to_string(&persisted_as_snapshot).unwrap(); let mut f = std::fs::File::create(&self.file).expect("failed to open file for writing"); writeln!(f, "{}", plaintext).expect("failed to write");