[PATCH] lib: move call to _n_m_invalidate_metadata

Subject: [PATCH] lib: move call to _n_m_invalidate_metadata

Date: Sun, 1 Sep 2024 11:41:40 -0400

To: notmuch@notmuchmail.org

Cc:

From: David Bremner


It is wrong most of the time in _notmuch_message_remove_terms, but
that function is too low level to know how to call
_n_m_invalidate_metadata with the right argument, at least not without
more extensive changes. This change merely makes the current behaviour
more obvious, since the other calls cannot have relied on metadata
being invalidated.
---
 lib/message-property.cc | 1 +
 lib/message.cc          | 2 --
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/lib/message-property.cc b/lib/message-property.cc
index 7f520340..772437eb 100644
--- a/lib/message-property.cc
+++ b/lib/message-property.cc
@@ -151,6 +151,7 @@ _notmuch_message_remove_all_properties (notmuch_message_t *message, const char *
     try {
 	/* XXX better error reporting ? */
 	_notmuch_message_remove_terms (message, term_prefix);
+	_notmuch_message_invalidate_metadata (message, "property");
     } catch (Xapian::Error &error) {
 	LOG_XAPIAN_EXCEPTION (message, error);
 	return NOTMUCH_STATUS_XAPIAN_EXCEPTION;
diff --git a/lib/message.cc b/lib/message.cc
index 46638f80..94e1bb12 100644
--- a/lib/message.cc
+++ b/lib/message.cc
@@ -719,8 +719,6 @@ _notmuch_message_remove_terms (notmuch_message_t *message, const char *prefix)
 	    /* Ignore failure to remove non-existent term. */
 	}
     }
-
-    _notmuch_message_invalidate_metadata (message, "property");
 }
 
 
-- 
2.43.0

_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: