]> git.notmuchmail.org Git - notmuch/commitdiff
config: only exclude messages if 'search.exclude_tags' is explicitly set
authorPieter Praet <pieter@praet.org>
Mon, 23 Jan 2012 04:22:34 +0000 (05:22 +0100)
committerDavid Bremner <bremner@debian.org>
Mon, 23 Jan 2012 23:21:18 +0000 (19:21 -0400)
Currently, the 'search.exclude_tags' option is automatically
set to "deleted;spam;" if it's missing from the config file.

This violates the Principle of Least Surprise, so *only* set
'search.exclude_tags' to "deleted;spam;" if we didn't find a
configuration file at all.

This patch is actually Austin Clements' work:
  id:"20120117203211.GQ16740@mit.edu"

notmuch-config.c
test/search

index 39da8889edb41b6c11a2f3af49a5edd46fbc7350..0ded6d739962d26d6c9ba61bbea4f9cc583b5d7b 100644 (file)
@@ -362,8 +362,12 @@ notmuch_config_open (void *ctx,
     }
 
     if (notmuch_config_get_search_exclude_tags (config, &tmp) == NULL) {
-       const char *tags[] = { "deleted", "spam" };
-       notmuch_config_set_search_exclude_tags (config, tags, 2);
+       if (is_new) {
+           const char *tags[] = { "deleted", "spam" };
+           notmuch_config_set_search_exclude_tags (config, tags, 2);
+       } else {
+           notmuch_config_set_search_exclude_tags (config, NULL, 0);
+       }
     }
 
     error = NULL;
index 99d94bd29ee34aeacd15436f6450410a6a2749a3..414be35610ef8812e398e8b85b988230881a12d6 100755 (executable)
@@ -149,7 +149,6 @@ test_expect_equal "$output" "thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; N
 thread:XXX   2001-01-05 [1/2] Notmuch Test Suite; Not deleted reply (deleted inbox unread)"
 
 test_begin_subtest "Don't exclude \"deleted\" messages from search if not configured"
-test_subtest_known_broken
 notmuch config set search.exclude_tags
 output=$(notmuch search subject:deleted | notmuch_search_sanitize)
 test_expect_equal "$output" "thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Not deleted (inbox unread)