unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH 1/2] test: add known broken test for ignoring non-toplevel .notmuch
@ 2021-12-26 12:24 David Bremner
  2021-12-26 12:24 ` [PATCH 2/2] cli/new: only ignore .notmuch at top level David Bremner
  2022-01-16 15:10 ` [PATCH 1/2] test: add known broken test for ignoring non-toplevel .notmuch David Bremner
  0 siblings, 2 replies; 3+ messages in thread
From: David Bremner @ 2021-12-26 12:24 UTC (permalink / raw)
  To: notmuch

In [1] Rob observed that notmuch new ignored directories called
.notmuch everywhere in the tree, where they should only (and now, with
split configs, at most) be ignored at the top level. Add a test to
demonstrate the problem.

[1]: id:87mwhifu9a.fsf@trouble.defaultvalue.org
---
 test/T050-new.sh | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/test/T050-new.sh b/test/T050-new.sh
index 7ea127d3..db13090b 100755
--- a/test/T050-new.sh
+++ b/test/T050-new.sh
@@ -351,6 +351,17 @@ 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
+cat <<EOF > EXPECTED
+Added 1 new message to the database.
+thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Do not ignore, very important (inbox unread)
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
 test_begin_subtest "RFC822 group names are indexed"
 test_subtest_known_broken
 generate_message [to]="undisclosed-recipients:"
-- 
2.34.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] cli/new: only ignore .notmuch at top level
  2021-12-26 12:24 [PATCH 1/2] test: add known broken test for ignoring non-toplevel .notmuch David Bremner
@ 2021-12-26 12:24 ` David Bremner
  2022-01-16 15:10 ` [PATCH 1/2] test: add known broken test for ignoring non-toplevel .notmuch David Bremner
  1 sibling, 0 replies; 3+ messages in thread
From: David Bremner @ 2021-12-26 12:24 UTC (permalink / raw)
  To: notmuch

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    | 5 +++--
 test/T050-new.sh | 1 -
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/notmuch-new.c b/notmuch-new.c
index 5b8fa340..346e6469 100644
--- a/notmuch-new.c
+++ b/notmuch-new.c
@@ -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);
diff --git a/test/T050-new.sh b/test/T050-new.sh
index db13090b..6791f87c 100755
--- a/test/T050-new.sh
+++ b/test/T050-new.sh
@@ -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
-- 
2.34.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] test: add known broken test for ignoring non-toplevel .notmuch
  2021-12-26 12:24 [PATCH 1/2] test: add known broken test for ignoring non-toplevel .notmuch David Bremner
  2021-12-26 12:24 ` [PATCH 2/2] cli/new: only ignore .notmuch at top level David Bremner
@ 2022-01-16 15:10 ` David Bremner
  1 sibling, 0 replies; 3+ messages in thread
From: David Bremner @ 2022-01-16 15:10 UTC (permalink / raw)
  To: notmuch

David Bremner <david@tethera.net> writes:

> In [1] Rob observed that notmuch new ignored directories called
> .notmuch everywhere in the tree, where they should only (and now, with
> split configs, at most) be ignored at the top level. Add a test to
> demonstrate the problem.
>
> [1]: id:87mwhifu9a.fsf@trouble.defaultvalue.org

Series applied to master.

d

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-01-16 15:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-26 12:24 [PATCH 1/2] test: add known broken test for ignoring non-toplevel .notmuch David Bremner
2021-12-26 12:24 ` [PATCH 2/2] cli/new: only ignore .notmuch at top level David Bremner
2022-01-16 15:10 ` [PATCH 1/2] test: add known broken test for ignoring non-toplevel .notmuch David Bremner

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).