From b335311caa96c32f2a6578661f01b1643ecffa2e Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Thu, 2 Jan 2020 14:32:19 +0100 Subject: Store::retrieve_mail_from_path() should have a flag to force making a ref out of the entry Because if the entry already exists, we might override the ref anyways. Signed-off-by: Matthias Beyer --- bin/domain/imag-mail/src/lib.rs | 2 +- lib/domain/libimagmail/src/store.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/domain/imag-mail/src/lib.rs b/bin/domain/imag-mail/src/lib.rs index ed931451..d3cb8c41 100644 --- a/bin/domain/imag-mail/src/lib.rs +++ b/bin/domain/imag-mail/src/lib.rs @@ -129,7 +129,7 @@ fn import_mail(rt: &Runtime) -> Result<()> { .map(PathBuf::from) .map(|path| { if scmd.is_present("ignore-existing-ids") { - store.retrieve_mail_from_path(path, &collection_name, &refconfig) + store.retrieve_mail_from_path(path, &collection_name, &refconfig, true) } else { store.create_mail_from_path(path, &collection_name, &refconfig) } diff --git a/lib/domain/libimagmail/src/store.rs b/lib/domain/libimagmail/src/store.rs index f66fd047..e328130a 100644 --- a/lib/domain/libimagmail/src/store.rs +++ b/lib/domain/libimagmail/src/store.rs @@ -50,7 +50,7 @@ pub trait MailStore<'a> { -> Result>> where P: AsRef + Debug; - fn retrieve_mail_from_path(&'a self, p: P, collection_name: CollName, config: &Config) + fn retrieve_mail_from_path(&'a self, p: P, collection_name: CollName, config: &Config, force_making_ref: bool) -> Result> where P: AsRef + Debug, CollName: AsRef + Debug; @@ -109,7 +109,7 @@ impl<'a> MailStore<'a> for Store { } } - fn retrieve_mail_from_path(&'a self, p: P, collection_name: CollName, config: &Config) + fn retrieve_mail_from_path(&'a self, p: P, collection_name: CollName, config: &Config, force_making_ref: bool) -> Result> where P: AsRef + Debug, CollName: AsRef + Debug @@ -124,7 +124,7 @@ impl<'a> MailStore<'a> for Store { entry .as_ref_with_hasher_mut::() - .make_ref(p, collection_name, config, false)?; + .make_ref(p, collection_name, config, force_making_ref)?; Ok(entry) } -- cgit v1.2.3