summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2020-01-02 14:32:19 +0100
committerMatthias Beyer <mail@beyermatthias.de>2020-01-02 14:51:57 +0100
commitb335311caa96c32f2a6578661f01b1643ecffa2e (patch)
treeca7e71bf1e4827114564c6dae7282d68bcdd181f
parent1c8c02c904abd913ed7621fc43eecd57c4b7aeec (diff)
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 <mail@beyermatthias.de>
-rw-r--r--bin/domain/imag-mail/src/lib.rs2
-rw-r--r--lib/domain/libimagmail/src/store.rs6
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<Option<FileLockEntry<'a>>>
where P: AsRef<Path> + Debug;
- fn retrieve_mail_from_path<P, CollName>(&'a self, p: P, collection_name: CollName, config: &Config)
+ fn retrieve_mail_from_path<P, CollName>(&'a self, p: P, collection_name: CollName, config: &Config, force_making_ref: bool)
-> Result<FileLockEntry<'a>>
where P: AsRef<Path> + Debug,
CollName: AsRef<str> + Debug;
@@ -109,7 +109,7 @@ impl<'a> MailStore<'a> for Store {
}
}
- fn retrieve_mail_from_path<P, CollName>(&'a self, p: P, collection_name: CollName, config: &Config)
+ fn retrieve_mail_from_path<P, CollName>(&'a self, p: P, collection_name: CollName, config: &Config, force_making_ref: bool)
-> Result<FileLockEntry<'a>>
where P: AsRef<Path> + Debug,
CollName: AsRef<str> + Debug
@@ -124,7 +124,7 @@ impl<'a> MailStore<'a> for Store {
entry
.as_ref_with_hasher_mut::<DefaultHasher>()
- .make_ref(p, collection_name, config, false)?;
+ .make_ref(p, collection_name, config, force_making_ref)?;
Ok(entry)
}