[PATCH v3 1/8] lib/config: add config keys for git-remote-notmuch.

Subject: [PATCH v3 1/8] lib/config: add config keys for git-remote-notmuch.

Date: Fri, 8 Aug 2025 14:14:37 -0300

To: notmuch@notmuchmail.org

Cc:

From: David Bremner


The precise function will be explained in a future update to
notmuch-config(1).
---
 lib/config.cc            | 11 +++++++++++
 lib/notmuch.h            |  3 +++
 test/T030-config.sh      |  3 +++
 test/T055-path-config.sh |  6 ++++++
 test/T590-libconfig.sh   | 12 ++++++++++++
 5 files changed, 35 insertions(+)

diff --git a/lib/config.cc b/lib/config.cc
index 6cc59869..fbab7742 100644
--- a/lib/config.cc
+++ b/lib/config.cc
@@ -608,6 +608,12 @@ _notmuch_config_key_to_string (notmuch_config_key_t key)
 	return "search.authors_matched_separator";
     case NOTMUCH_CONFIG_INDEX_AS_TEXT:
 	return "index.as_text";
+    case NOTMUCH_CONFIG_GIT_FAIL_ON_MISSING:
+	return "git.fail_on_missing";
+    case NOTMUCH_CONFIG_GIT_METADATA_PREFIX:
+	return "git.metadata_prefix";
+    case NOTMUCH_CONFIG_GIT_REF:
+	return "git.ref";
     default:
 	return NULL;
     }
@@ -636,6 +642,7 @@ _notmuch_config_default (notmuch_database_t *notmuch, notmuch_config_key_t key)
     case NOTMUCH_CONFIG_NEW_TAGS:
 	return "unread;inbox";
     case NOTMUCH_CONFIG_SYNC_MAILDIR_FLAGS:
+    case NOTMUCH_CONFIG_GIT_FAIL_ON_MISSING:
 	return "true";
     case NOTMUCH_CONFIG_USER_NAME:
 	name = getenv ("NAME");
@@ -660,6 +667,10 @@ _notmuch_config_default (notmuch_database_t *notmuch, notmuch_config_key_t key)
 	return ", ";
     case NOTMUCH_CONFIG_AUTHORS_MATCHED_SEPARATOR:
 	return "| ";
+    case NOTMUCH_CONFIG_GIT_METADATA_PREFIX:
+	return "_notmuch_metadata";
+    case NOTMUCH_CONFIG_GIT_REF:
+	return "refs/heads/master";
     case NOTMUCH_CONFIG_EXTRA_HEADERS:
     case NOTMUCH_CONFIG_HOOK_DIR:
     case NOTMUCH_CONFIG_BACKUP_DIR:
diff --git a/lib/notmuch.h b/lib/notmuch.h
index 95918fc2..7f520c49 100644
--- a/lib/notmuch.h
+++ b/lib/notmuch.h
@@ -2635,6 +2635,9 @@ typedef enum {
     NOTMUCH_CONFIG_INDEX_AS_TEXT,
     NOTMUCH_CONFIG_AUTHORS_SEPARATOR,
     NOTMUCH_CONFIG_AUTHORS_MATCHED_SEPARATOR,
+    NOTMUCH_CONFIG_GIT_FAIL_ON_MISSING,
+    NOTMUCH_CONFIG_GIT_METADATA_PREFIX,
+    NOTMUCH_CONFIG_GIT_REF,
     NOTMUCH_CONFIG_LAST
 } notmuch_config_key_t;
 
diff --git a/test/T030-config.sh b/test/T030-config.sh
index 1d2b7df8..ce6653ee 100755
--- a/test/T030-config.sh
+++ b/test/T030-config.sh
@@ -59,6 +59,9 @@ database.mail_root=MAIL_DIR
 database.path=MAIL_DIR
 foo.list=this;is another;list value;
 foo.string=this is another string value
+git.fail_on_missing=true
+git.metadata_prefix=_notmuch_metadata
+git.ref=refs/heads/master
 index.as_text=
 maildir.synchronize_flags=true
 new.ignore=
diff --git a/test/T055-path-config.sh b/test/T055-path-config.sh
index 049b745e..4d1edec0 100755
--- a/test/T055-path-config.sh
+++ b/test/T055-path-config.sh
@@ -299,6 +299,9 @@ database.backup_dir
 database.hook_dir
 database.mail_root=MAIL_DIR
 database.path
+git.fail_on_missing=true
+git.metadata_prefix=_notmuch_metadata
+git.ref=refs/heads/master
 index.as_text=
 maildir.synchronize_flags=true
 new.ignore=
@@ -325,6 +328,9 @@ database.backup_dir
 database.hook_dir
 database.mail_root
 database.path
+git.fail_on_missing
+git.metadata_prefix
+git.ref
 maildir.synchronize_flags
 new.tags
 search.authors_matched_separator
diff --git a/test/T590-libconfig.sh b/test/T590-libconfig.sh
index 9b364895..e893fd1f 100755
--- a/test/T590-libconfig.sh
+++ b/test/T590-libconfig.sh
@@ -443,6 +443,9 @@ cat <<'EOF' >EXPECTED
 13: ''
 14: ', '
 15: '| '
+16: 'true'
+17: '_notmuch_metadata'
+18: 'refs/heads/master'
 == stderr ==
 EOF
 unset MAILDIR
@@ -760,6 +763,9 @@ cat <<'EOF' >EXPECTED
 13: 'text/'
 14: ', '
 15: '| '
+16: 'true'
+17: '_notmuch_metadata'
+18: 'refs/heads/master'
 == stderr ==
 EOF
 test_expect_equal_file EXPECTED OUTPUT
@@ -797,6 +803,9 @@ cat <<'EOF' >EXPECTED
 13: ''
 14: ', '
 15: '| '
+16: 'true'
+17: '_notmuch_metadata'
+18: 'refs/heads/master'
 == stderr ==
 EOF
 test_expect_equal_file EXPECTED OUTPUT.clean
@@ -868,6 +877,9 @@ database.backup_dir MAIL_DIR/.notmuch/backups
 database.hook_dir MAIL_DIR/.notmuch/hooks
 database.mail_root MAIL_DIR
 database.path MAIL_DIR
+git.fail_on_missing true
+git.metadata_prefix _notmuch_metadata
+git.ref refs/heads/master
 index.as_text text/
 key with spaces value, with, spaces!
 maildir.synchronize_flags true
-- 
2.47.2

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

Thread: