Re: [PATCH 9/9] add has: query prefix to search for specific properties
[notmuch-archives.git] / ff / 079142de71e24c47750e1cfdec5aca68289403
1 Return-Path: <bremner@tethera.net>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5  by arlo.cworth.org (Postfix) with ESMTP id 038616DE1271\r
6  for <notmuch@notmuchmail.org>; Sat, 10 Oct 2015 05:30:01 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0.105\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0.105 tagged_above=-999 required=5 tests=[AWL=0.105]\r
12  autolearn=disabled\r
13 Received: from arlo.cworth.org ([127.0.0.1])\r
14  by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
15  with ESMTP id x2bikh0Zri6b for <notmuch@notmuchmail.org>;\r
16  Sat, 10 Oct 2015 05:29:59 -0700 (PDT)\r
17 Received: from gitolite.debian.net (gitolite.debian.net [87.98.215.224])\r
18  by arlo.cworth.org (Postfix) with ESMTPS id 0E1E26DE1502\r
19  for <notmuch@notmuchmail.org>; Sat, 10 Oct 2015 05:29:59 -0700 (PDT)\r
20 Received: from remotemail by gitolite.debian.net with local (Exim 4.80)\r
21  (envelope-from <bremner@tethera.net>)\r
22  id 1ZktGF-0008Av-01; Sat, 10 Oct 2015 12:28:26 +0000\r
23 Received: (nullmailer pid 8598 invoked by uid 1000); Sat, 10 Oct 2015\r
24  12:27:30 -0000\r
25 From: David Bremner <david@tethera.net>\r
26 To: Jani Nikula <jani@nikula.org>, notmuch@notmuchmail.org\r
27 Subject: [PATCH 3/3] cli: delete directory documents on directory removal\r
28 Date: Sat, 10 Oct 2015 09:27:19 -0300\r
29 Message-Id: <1444480039-8530-4-git-send-email-david@tethera.net>\r
30 X-Mailer: git-send-email 2.5.3\r
31 In-Reply-To: <1444480039-8530-1-git-send-email-david@tethera.net>\r
32 References:\r
33  <591f5298ac3f2c79f727cac8bad1251830b28a3c.1443213654.git.jani@nikula.org>\r
34  <1444480039-8530-1-git-send-email-david@tethera.net>\r
35 X-BeenThere: notmuch@notmuchmail.org\r
36 X-Mailman-Version: 2.1.18\r
37 Precedence: list\r
38 List-Id: "Use and development of the notmuch mail system."\r
39  <notmuch.notmuchmail.org>\r
40 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
41  <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
42 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
43 List-Post: <mailto:notmuch@notmuchmail.org>\r
44 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
45 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
46  <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
47 X-List-Received-Date: Sat, 10 Oct 2015 12:30:01 -0000\r
48 \r
49 From: Jani Nikula <jani@nikula.org>\r
50 \r
51 There was a problem with the directory documents being left behind when\r
52 the filesystem directory was removed. This was worked around in [1].\r
53 However, that ignored the fact that the directory documents are also\r
54 still listed by notmuch_directory_get_child_directories() leading to\r
55 confusing results when running notmuch new. The directory documents are\r
56 found and queued for removal over and over again.\r
57 \r
58 Fix the problem for real by removing the directory documents. This fixes\r
59 the tests flagged as broken in [2].\r
60 \r
61 The (non-deterministic) hack test from [1] also still passes with this\r
62 change.\r
63 \r
64 [1] commit acd66cdec075312944e527febd46382e54d99367\r
65 [2] commit ed9ceda623d3f22fb66365b33db63c5c982067d3\r
66 [3] id:1441445731-4362-1-git-send-email-jani@nikula.org\r
67 ---\r
68  notmuch-new.c    | 12 +++---------\r
69  test/T050-new.sh |  6 ------\r
70  2 files changed, 3 insertions(+), 15 deletions(-)\r
71 \r
72 diff --git a/notmuch-new.c b/notmuch-new.c\r
73 index 442a2f0..d45d0af 100644\r
74 --- a/notmuch-new.c\r
75 +++ b/notmuch-new.c\r
76 @@ -878,17 +878,11 @@ _remove_directory (void *ctx,\r
77             goto DONE;\r
78      }\r
79  \r
80 -    /*\r
81 -     * XXX: The library does not have a function to remove a directory\r
82 -     * document for a path. Usually this doesn't matter except for a\r
83 -     * slight waste of space. However, if the directory gets added to\r
84 -     * the filesystem again, the old directory document is found with\r
85 -     * the old mtime. Reset the directory mtime to avoid problems.\r
86 -     */\r
87 -    notmuch_directory_set_mtime (directory, 0);\r
88 +    status = notmuch_directory_delete (directory);\r
89  \r
90    DONE:\r
91 -    notmuch_directory_destroy (directory);\r
92 +    if (status)\r
93 +       notmuch_directory_destroy (directory);\r
94      return status;\r
95  }\r
96  \r
97 diff --git a/test/T050-new.sh b/test/T050-new.sh\r
98 index 33ce1ab..81cf2fa 100755\r
99 --- a/test/T050-new.sh\r
100 +++ b/test/T050-new.sh\r
101 @@ -93,7 +93,6 @@ No new mail. Detected 3 file renames."\r
102  \r
103  \r
104  test_begin_subtest "Deleted directory"\r
105 -test_subtest_known_broken\r
106  rm -rf "${MAIL_DIR}"/dir-renamed\r
107  \r
108  output=$(NOTMUCH_NEW --debug)\r
109 @@ -102,7 +101,6 @@ No new mail. Removed 3 messages."\r
110  \r
111  \r
112  test_begin_subtest "New directory (at end of list)"\r
113 -test_subtest_known_broken\r
114  \r
115  generate_message [dir]=zzz\r
116  generate_message [dir]=zzz\r
117 @@ -114,7 +112,6 @@ test_expect_equal "$output" "Added 3 new messages to the database."\r
118  \r
119  test_begin_subtest "Deleted directory (end of list)"\r
120  \r
121 -test_subtest_known_broken\r
122  rm -rf "${MAIL_DIR}"/zzz\r
123  \r
124  output=$(NOTMUCH_NEW --debug)\r
125 @@ -173,7 +170,6 @@ test_expect_equal "$output" "(D) add_files_recursive, pass 3: queuing leftover d\r
126  No new mail. Removed 3 messages."\r
127  \r
128  test_begin_subtest "Support single-message mbox"\r
129 -test_subtest_known_broken\r
130  cat > "${MAIL_DIR}"/mbox_file1 <<EOF\r
131  From test_suite@notmuchmail.org Fri Jan  5 15:43:57 2001\r
132  From: Notmuch Test Suite <test_suite@notmuchmail.org>\r
133 @@ -187,7 +183,6 @@ test_expect_equal "$output" "Added 1 new message to the database."\r
134  \r
135  # This test requires that notmuch new has been run at least once.\r
136  test_begin_subtest "Skip and report non-mail files"\r
137 -test_subtest_known_broken\r
138  generate_message\r
139  mkdir -p "${MAIL_DIR}"/.git && touch "${MAIL_DIR}"/.git/config\r
140  touch "${MAIL_DIR}"/ignored_file\r
141 @@ -224,7 +219,6 @@ output=$(NOTMUCH_NEW 2>&1)\r
142  test_expect_equal "$output" "Added 1 new message to the database."\r
143  \r
144  test_begin_subtest "Ignore files and directories specified in new.ignore (multiple occurrences)"\r
145 -test_subtest_known_broken\r
146  notmuch config set new.ignore .git ignored_file .ignored_hidden_file\r
147  notmuch new > /dev/null # ensure that files/folders will be printed in ASCII order.\r
148  touch "${MAIL_DIR}"/.git # change .git's mtime for notmuch new to rescan.\r
149 -- \r
150 2.5.3\r
151 \r