From 400544738b49ad227bb39a1eb2ade4e22980a3ff Mon Sep 17 00:00:00 2001 From: Ellie Huxtable Date: Wed, 5 Apr 2023 09:23:09 +0100 Subject: [PATCH] Fix deleting history that doesn't exist yet (#844) This can occur if history has been added + then deleted on a machine before it has a chance to be synced to a new one. --- atuin-client/src/sync.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/atuin-client/src/sync.rs b/atuin-client/src/sync.rs index 474084d..e62a148 100644 --- a/atuin-client/src/sync.rs +++ b/atuin-client/src/sync.rs @@ -95,8 +95,14 @@ async fn sync_download( for i in remote_status.deleted { // we will update the stored history to have this data // pretty much everything can be nullified - let h = db.load(i.as_str()).await?; - db.delete(h).await?; + if let Ok(h) = db.load(i.as_str()).await { + db.delete(h).await?; + } else { + info!( + "could not delete history with id {}, not found locally", + i.as_str() + ); + } } Ok((local_count - initial_local, local_count))