[PATCH 3/6] lib/config: add configuration item for controlling check for mbox

Subject:[PATCH 3/6] lib/config: add configuration item for controlling check for mbox

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

To:notmuch@notmuchmail.org

Cc:

From:David Bremner


Currently we always check for multi-message mboxes, but some people
would prefer to disable this check. Set up infrastructure to disable
check.
---
 lib/config.cc            | 4 ++++
 lib/notmuch.h            | 1 +
 test/T030-config.sh      | 1 +
 test/T055-path-config.sh | 1 +
 test/T590-libconfig.sh   | 4 ++++
 5 files changed, 11 insertions(+)

diff --git a/lib/config.cc b/lib/config.cc
index 503a0c8b..296bc3b8 100644
--- a/lib/config.cc
+++ b/lib/config.cc
@@ -581,6 +581,8 @@ _notmuch_config_key_to_string (notmuch_config_key_t key)
 	return "database.hook_dir";
     case NOTMUCH_CONFIG_BACKUP_DIR:
 	return "database.backup_dir";
+    case NOTMUCH_CONFIG_CHECK_MBOX:
+	return "index.check_mbox";
     case NOTMUCH_CONFIG_EXCLUDE_TAGS:
 	return "search.exclude_tags";
     case NOTMUCH_CONFIG_NEW_TAGS:
@@ -628,6 +630,8 @@ _notmuch_config_default (notmuch_database_t *notmuch, notmuch_config_key_t key)
 	return "unread;inbox";
     case NOTMUCH_CONFIG_SYNC_MAILDIR_FLAGS:
 	return "true";
+    case NOTMUCH_CONFIG_CHECK_MBOX:
+	return "true";
     case NOTMUCH_CONFIG_USER_NAME:
 	name = getenv ("NAME");
 	if (name)
diff --git a/lib/notmuch.h b/lib/notmuch.h
index 2e6ec2af..f0cf1a09 100644
--- a/lib/notmuch.h
+++ b/lib/notmuch.h
@@ -2551,6 +2551,7 @@ typedef enum {
     NOTMUCH_CONFIG_USER_NAME,
     NOTMUCH_CONFIG_AUTOCOMMIT,
     NOTMUCH_CONFIG_EXTRA_HEADERS,
+    NOTMUCH_CONFIG_CHECK_MBOX,
     NOTMUCH_CONFIG_LAST
 } notmuch_config_key_t;
 
diff --git a/test/T030-config.sh b/test/T030-config.sh
index 43bbce31..fe7ac4a6 100755
--- a/test/T030-config.sh
+++ b/test/T030-config.sh
@@ -57,6 +57,7 @@ database.mail_root=MAIL_DIR
 database.path=MAIL_DIR
 foo.list=this;is another;list value;
 foo.string=this is another string value
+index.check_mbox=true
 maildir.synchronize_flags=true
 new.ignore=
 new.tags=unread;inbox
diff --git a/test/T055-path-config.sh b/test/T055-path-config.sh
index 1df240dd..2a518892 100755
--- a/test/T055-path-config.sh
+++ b/test/T055-path-config.sh
@@ -283,6 +283,7 @@ database.backup_dir
 database.hook_dir
 database.mail_root=MAIL_DIR
 database.path
+index.check_mbox=true
 maildir.synchronize_flags=true
 new.ignore=
 new.tags=unread;inbox
diff --git a/test/T590-libconfig.sh b/test/T590-libconfig.sh
index 26a1f033..034ac8e6 100755
--- a/test/T590-libconfig.sh
+++ b/test/T590-libconfig.sh
@@ -440,6 +440,7 @@ cat <<'EOF' >EXPECTED
 10: 'USER_FULL_NAME'
 11: '8000'
 12: 'NULL'
+13: 'true'
 == stderr ==
 EOF
 unset MAILDIR
@@ -751,6 +752,7 @@ cat <<'EOF' >EXPECTED
 10: 'Notmuch Test Suite'
 11: '8000'
 12: 'NULL'
+13: 'true'
 == stderr ==
 EOF
 test_expect_equal_file EXPECTED OUTPUT
@@ -785,6 +787,7 @@ cat <<'EOF' >EXPECTED
 10: 'USER_FULL_NAME'
 11: '8000'
 12: 'NULL'
+13: 'true'
 == stderr ==
 EOF
 test_expect_equal_file EXPECTED OUTPUT.clean
@@ -856,6 +859,7 @@ database.backup_dir MAIL_DIR/.notmuch/backups
 database.hook_dir MAIL_DIR/.notmuch/hooks
 database.mail_root MAIL_DIR
 database.path MAIL_DIR
+index.check_mbox true
 key with spaces value, with, spaces!
 maildir.synchronize_flags true
 new.ignore sekrit_junk
-- 
2.34.1

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

Thread: