]> git.cworth.org Git - notmuch/commitdiff
CLI/setup: special case single item lists
authorDavid Bremner <david@tethera.net>
Mon, 17 Jan 2022 23:54:53 +0000 (19:54 -0400)
committerDavid Bremner <david@tethera.net>
Mon, 24 Jan 2022 13:32:39 +0000 (09:32 -0400)
This matches the heuristic used by "notmuch config set" to decide if
something is a list.

This change fixes the bug reported at [1].

[1]: id:6O3LTUhoXlrnkPWCtPJCP4cagU7mFVEdyTpcC_37BoSzStlARXDBa7oczy6hB0jyjGjBQvgj_jFV58cw0aNx-jUg1h1O-FQ7820k68C0X4M=@protonmail.com

notmuch-config.c
test/T040-setup.sh
test/setup.expected-output/config-with-comments

index 11d8d68b5b5ead71d24d9f37202eaf958e8b1ccd..e9456d794456c080e81abbd6a00efcb6b123c3c4 100644 (file)
@@ -383,7 +383,10 @@ _config_set_list (notmuch_conffile_t *config,
                  const char *list[],
                  size_t length)
 {
-    g_key_file_set_string_list (config->key_file, group, key, list, length);
+    if (length > 1)
+       g_key_file_set_string_list (config->key_file, group, key, list, length);
+    else
+       g_key_file_set_string (config->key_file, group, key, list[0]);
 }
 
 void
index 36a425628ec750e574778339f97e386276d530a6..10b29ec33f3a726f261feb5df98d58789643cf3e 100755 (executable)
@@ -24,7 +24,6 @@ expected_dir=$NOTMUCH_SRCDIR/test/setup.expected-output
 test_expect_equal_file ${expected_dir}/config-with-comments new-notmuch-config
 
 test_begin_subtest "setup consistent with config-set for single items"
-test_subtest_known_broken
 # note this relies on the config state from the previous test.
 notmuch --config=new-notmuch-config config list > list.setup
 notmuch --config=new-notmuch-config config set search.exclude_tags baz
index 56c628e56b29f5007f49e78908238f8370d872cd..d8397714874cbc4236422aa61bdda53f7e322205 100644 (file)
@@ -31,7 +31,7 @@ path=/path/to/maildir
 [user]
 name=Test Suite
 primary_email=test.suite@example.com
-other_email=another.suite@example.com;
+other_email=another.suite@example.com
 
 # Configuration for "notmuch new"
 #
@@ -60,7 +60,7 @@ tags=foo;bar;
 #              query will override that exclusion.
 #
 [search]
-exclude_tags=baz;
+exclude_tags=baz
 
 # Maildir compatibility configuration
 #