[PATCH 6/6] lib/message-file: allow disabling check for mbox files.

Subject: [PATCH 6/6] lib/message-file: allow disabling check for mbox files.

Date: Sat, 5 Feb 2022 15:52:15 -0400

To: notmuch@notmuchmail.org

Cc:

From: David Bremner


This does not change the default (of enforcing the check) but does
allow users to disable the check if they want.
---
 lib/message-file.c | 9 +++++++--
 test/T050-new.sh   | 1 -
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/lib/message-file.c b/lib/message-file.c
index 0f356cf1..e2bd406b 100644
--- a/lib/message-file.c
+++ b/lib/message-file.c
@@ -145,14 +145,19 @@ _notmuch_message_file_parse (notmuch_message_file_t *message)
     GMimeParser *parser;
     notmuch_status_t status = NOTMUCH_STATUS_SUCCESS;
     bool is_mbox;
+    notmuch_bool_t check_mbox;
 
     if (message->message)
 	return NOTMUCH_STATUS_SUCCESS;
 
-    is_mbox = _is_mbox (message->stream);
-
     _notmuch_init ();
 
+    status = notmuch_config_get_bool (message->notmuch, NOTMUCH_CONFIG_CHECK_MBOX, &check_mbox);
+    if (status)
+	return status;
+
+    is_mbox = check_mbox && _is_mbox (message->stream);
+
     message->headers = g_hash_table_new_full (strcase_hash, strcase_equal,
 					      free, g_free);
     if (! message->headers)
diff --git a/test/T050-new.sh b/test/T050-new.sh
index e779bd2f..aa777235 100755
--- a/test/T050-new.sh
+++ b/test/T050-new.sh
@@ -464,7 +464,6 @@ output=$(notmuch search --output=messages id:87k0e9o0pu.fsf@tethera.net)
 test_expect_equal "$output" "id:87k0e9o0pu.fsf@tethera.net"
 
 test_begin_subtest "id:87k0e9o0pu.fsf@tethera.net is indexed with index.check_mbox=false"
-test_subtest_known_broken
 cp notmuch-config notmuch-config.old
 notmuch config set index.check_mbox false
 notmuch new
-- 
2.34.1

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

Thread: