]> git.notmuchmail.org Git - notmuch/commitdiff
cli/new: only ignore .notmuch at top level
authorDavid Bremner <david@tethera.net>
Sun, 26 Dec 2021 12:24:10 +0000 (08:24 -0400)
committerDavid Bremner <david@tethera.net>
Sun, 16 Jan 2022 14:52:13 +0000 (10:52 -0400)
Since the bug was first reported in [1], notmuch has gained the
ability to have the database located outside the mail root, hence this
this change differs slightly from Jani's proposed solution [2] in not
using notmuch_database_get_path, but rather the already retrieved
mail_root.

[1]: id:87mwhifu9a.fsf@trouble.defaultvalue.org
[2]: id:87ios5v59p.fsf@nikula.org

notmuch-new.c
test/T050-new.sh

index 5b8fa340f598e6af5ed19942dd3034fed3f28671..346e64697aaf02763a38eb09e93ef428348aae4a 100644 (file)
@@ -601,11 +601,12 @@ add_files (notmuch_database_t *notmuch,
            continue;
        }
 
-       /* Ignore the .notmuch directory and any "tmp" directory
+       /* Ignore any top level .notmuch directory and any "tmp" directory
         * that appears within a maildir.
         */
        if ((is_maildir && strcmp (entry->d_name, "tmp") == 0) ||
-           strcmp (entry->d_name, ".notmuch") == 0)
+           (strcmp (entry->d_name, ".notmuch") == 0
+            && (strcmp (path, state->mail_root)) == 0))
            continue;
 
        next = talloc_asprintf (notmuch, "%s/%s", path, entry->d_name);
index db13090baf5d2e49b6c3466b4cc5fb7b491c74e6..6791f87c5c62914b48f36b7804d90316db9807fe 100755 (executable)
@@ -352,7 +352,6 @@ test_expect_code 1 "NOTMUCH_NEW --debug 2>&1"
 notmuch config set new.tags $OLDCONFIG
 
 test_begin_subtest ".notmuch only ignored at top level"
-test_subtest_known_broken
 generate_message '[dir]=foo/bar/.notmuch/cur' '[subject]="Do not ignore, very important"'
 NOTMUCH_NEW > OUTPUT
 notmuch search subject:Do-not-ignore | notmuch_search_sanitize >> OUTPUT