From 2f608d2a9400f666ec0aca1f76b59f6640104e4e Mon Sep 17 00:00:00 2001 From: David Bremner Date: Fri, 21 May 2021 12:54:10 -0300 Subject: [PATCH] lib/config: add NOTMUCH_CONFIG_AUTOCOMMIT This will be used to control how often atomic transactions are committed. --- 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 368ed669..7ecc3c7b 100644 --- a/lib/config.cc +++ b/lib/config.cc @@ -593,6 +593,8 @@ _notmuch_config_key_to_string (notmuch_config_key_t key) return "user.other_email"; case NOTMUCH_CONFIG_USER_NAME: return "user.name"; + case NOTMUCH_CONFIG_AUTOCOMMIT: + return "database.autocommit"; default: return NULL; } @@ -638,6 +640,8 @@ _notmuch_config_default (notmuch_database_t *notmuch, notmuch_config_key_t key) return email; case NOTMUCH_CONFIG_NEW_IGNORE: return ""; + case NOTMUCH_CONFIG_AUTOCOMMIT: + return "8000"; case NOTMUCH_CONFIG_HOOK_DIR: case NOTMUCH_CONFIG_BACKUP_DIR: case NOTMUCH_CONFIG_OTHER_EMAIL: diff --git a/lib/notmuch.h b/lib/notmuch.h index 4b053932..5c3be342 100644 --- a/lib/notmuch.h +++ b/lib/notmuch.h @@ -2520,6 +2520,7 @@ typedef enum _notmuch_config_key { NOTMUCH_CONFIG_PRIMARY_EMAIL, NOTMUCH_CONFIG_OTHER_EMAIL, NOTMUCH_CONFIG_USER_NAME, + NOTMUCH_CONFIG_AUTOCOMMIT, NOTMUCH_CONFIG_LAST } notmuch_config_key_t; diff --git a/test/T030-config.sh b/test/T030-config.sh index 7a1660e9..751feaf3 100755 --- a/test/T030-config.sh +++ b/test/T030-config.sh @@ -51,6 +51,7 @@ cat < EXPECTED built_with.compact=something built_with.field_processor=something built_with.retry_lock=something +database.autocommit=8000 database.mail_root=MAIL_DIR database.path=MAIL_DIR foo.list=this;is another;list value; diff --git a/test/T055-path-config.sh b/test/T055-path-config.sh index 8ef76aed..bb3bf665 100755 --- a/test/T055-path-config.sh +++ b/test/T055-path-config.sh @@ -259,6 +259,7 @@ EOF built_with.compact=true built_with.field_processor=true built_with.retry_lock=true +database.autocommit=8000 database.backup_dir database.hook_dir database.mail_root=MAIL_DIR diff --git a/test/T590-libconfig.sh b/test/T590-libconfig.sh index 189381f7..41f67bae 100755 --- a/test/T590-libconfig.sh +++ b/test/T590-libconfig.sh @@ -419,6 +419,7 @@ cat <<'EOF' >EXPECTED 08: 'USERNAME@FQDN' 09: 'NULL' 10: 'USER_FULL_NAME' +11: '8000' == stderr == EOF unset MAILDIR @@ -730,6 +731,7 @@ cat <<'EOF' >EXPECTED 08: 'test_suite@notmuchmail.org' 09: 'test_suite_other@notmuchmail.org;test_suite@otherdomain.org' 10: 'Notmuch Test Suite' +11: '8000' == stderr == EOF test_expect_equal_file EXPECTED OUTPUT @@ -762,6 +764,7 @@ cat <<'EOF' >EXPECTED 08: 'USERNAME@FQDN' 09: 'NULL' 10: 'USER_FULL_NAME' +11: '8000' == stderr == EOF test_expect_equal_file EXPECTED OUTPUT.clean @@ -828,6 +831,7 @@ EOF cat <<'EOF' >EXPECTED == stdout == aaabefore beforeval +database.autocommit 8000 database.backup_dir MAIL_DIR/.notmuch/backups database.hook_dir MAIL_DIR/.notmuch/hooks database.mail_root MAIL_DIR -- 2.43.0