store: ensure updates update message sexp too

And turn all "add" into "replace" so old messages get removed.
Update tests too.
This commit is contained in:
Dirk-Jan C. Binnema
2022-05-05 01:27:08 +03:00
parent c0ae7e6860
commit 6126d7ee62
8 changed files with 329 additions and 170 deletions

View File

@ -374,7 +374,12 @@ static bool
output_sexp(const Option<Message>& msg, const OutputInfo& info, const MuConfig* opts, GError** err)
{
if (msg) {
fputs(msg->to_sexp().to_sexp_string().c_str(), stdout);
if (const auto sexp{msg->cached_sexp()}; !sexp.empty())
fputs(sexp.c_str(), stdout);
else
fputs(msg->to_sexp().to_sexp_string().c_str(), stdout);
fputs("\n", stdout);
}
@ -476,7 +481,7 @@ output_query_results(const QueryResults& qres, const MuConfig* opts)
if (!msg)
continue;
if (opts->after != 0 && msg->mtime() < opts->after)
if (opts->after != 0 && msg->changed() < opts->after)
continue;
rv = output_func(msg,