[PATCH] RFC: all deleting all properties with a given key
[notmuch-archives.git] / 7a / f61361a2ee49ef66cd3c81df7e0845ebb8b367
1 Return-Path: <amdragon@mit.edu>\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 olra.theworths.org (Postfix) with ESMTP id 4C1D5431FAE\r
6         for <notmuch@notmuchmail.org>; Sat, 24 Nov 2012 21:26:02 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.7\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id 3qIDL1EweV0t for <notmuch@notmuchmail.org>;\r
16         Sat, 24 Nov 2012 21:26:00 -0800 (PST)\r
17 Received: from dmz-mailsec-scanner-6.mit.edu (DMZ-MAILSEC-SCANNER-6.MIT.EDU\r
18         [18.7.68.35])\r
19         by olra.theworths.org (Postfix) with ESMTP id AF362431FC0\r
20         for <notmuch@notmuchmail.org>; Sat, 24 Nov 2012 21:26:00 -0800 (PST)\r
21 X-AuditID: 12074423-b7fab6d0000008f9-06-50b1abe7d713\r
22 Received: from mailhub-auth-4.mit.edu ( [18.7.62.39])\r
23         by dmz-mailsec-scanner-6.mit.edu (Symantec Messaging Gateway) with SMTP\r
24         id 85.6F.02297.7EBA1B05; Sun, 25 Nov 2012 00:25:59 -0500 (EST)\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
26         by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id qAP5PnRF014562; \r
27         Sun, 25 Nov 2012 00:25:49 -0500\r
28 Received: from drake.dyndns.org\r
29         (209-6-116-242.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com\r
30         [209.6.116.242]) (authenticated bits=0)\r
31         (User authenticated as amdragon@ATHENA.MIT.EDU)\r
32         by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id qAP5PliO002625\r
33         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
34         Sun, 25 Nov 2012 00:25:48 -0500 (EST)\r
35 Received: from amthrax by drake.dyndns.org with local (Exim 4.77)\r
36         (envelope-from <amdragon@mit.edu>)\r
37         id 1TcUix-0007dW-EQ; Sun, 25 Nov 2012 00:25:47 -0500\r
38 From: Austin Clements <amdragon@MIT.EDU>\r
39 To: notmuch@notmuchmail.org\r
40 Subject: [PATCH 2/2] new: Skip ignored broken symlinks\r
41 Date: Sun, 25 Nov 2012 00:25:45 -0500\r
42 Message-Id: <1353821145-29182-3-git-send-email-amdragon@mit.edu>\r
43 X-Mailer: git-send-email 1.7.10.4\r
44 In-Reply-To: <1353821145-29182-1-git-send-email-amdragon@mit.edu>\r
45 References: <1353821145-29182-1-git-send-email-amdragon@mit.edu>\r
46 X-Brightmail-Tracker:\r
47  H4sIAAAAAAAAA+NgFtrEIsWRmVeSWpSXmKPExsUixG6nrvt89cYAg0n9qhbXb85kdmD0eLbq\r
48         FnMAYxSXTUpqTmZZapG+XQJXxr4Vh1gK3shUrD+ymqmB8ZZ4FyMnh4SAicTXt6fZIGwxiQv3\r
49         1gPZXBxCAvsYJW5PPsUO4WxglJj54gwjhPOISWLdi21QmbmMEu+7/zGB9LMJaEhs27+cEcQW\r
50         EZCW2Hl3NmsXIwcHs4CaxJ8uFZCwsICZxN11fcwgNouAqsSp1mNgNq+Ag8TVDfeZIM5QlOh+\r
51         NoENpJVTwFGiebowSFgIqGTvtCWMExj5FzAyrGKUTcmt0s1NzMwpTk3WLU5OzMtLLdI108vN\r
52         LNFLTSndxAgOGhflHYx/DiodYhTgYFTi4b2RuDFAiDWxrLgy9xCjJAeTkiiv1jKgEF9Sfkpl\r
53         RmJxRnxRaU5q8SFGCQ5mJRFea1WgHG9KYmVValE+TEqag0VJnPdayk1/IYH0xJLU7NTUgtQi\r
54         mKwMB4eSBK8KMDqEBItS01Mr0jJzShDSTBycIMN5gIaD1fAWFyTmFmemQ+RPMSpKifNygyQE\r
55         QBIZpXlwvbCofsUoDvSKMC8fSBUPMCHAdb8CGswENPjp7HUgg0sSEVJSDYwyT+btnrdaIStO\r
56         saRR88AVsZM5n31e7BF89+oly4/OZz5PtaesVLATt1DzCm6pXXd0Qr6rp0F0b2vNQp9/Dnlc\r
57         29K2J/zrS622zHkWvlayVy7tWfYcd1nlmXemeBw0DNuwZXbL571TNHsEppXs3/5wf9y1j+Ls\r
58         U76eKTgjuKjJpIKDy/MBe6kSS3FGoqEWc1FxIgCm1/kMxQIAAA==\r
59 X-BeenThere: notmuch@notmuchmail.org\r
60 X-Mailman-Version: 2.1.13\r
61 Precedence: list\r
62 List-Id: "Use and development of the notmuch mail system."\r
63         <notmuch.notmuchmail.org>\r
64 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
65         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
66 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
67 List-Post: <mailto:notmuch@notmuchmail.org>\r
68 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
69 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
70         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
71 X-List-Received-Date: Sun, 25 Nov 2012 05:26:02 -0000\r
72 \r
73 We now test for user ignore patterns before attempting to determine if\r
74 a directory entry is itself a directory.  As a result, we no longer\r
75 abort for broken symlinks if the user has explicitly ignored them.\r
76 \r
77 This fixes the test added in the previous patch.  It also slightly\r
78 changes the debug output checked by another test of ignores.\r
79 ---\r
80  notmuch-new.c |   26 +++++++++++++++-----------\r
81  test/new      |    6 +++++-\r
82  2 files changed, 20 insertions(+), 12 deletions(-)\r
83 \r
84 diff --git a/notmuch-new.c b/notmuch-new.c\r
85 index 56c4a6f..718a538 100644\r
86 --- a/notmuch-new.c\r
87 +++ b/notmuch-new.c\r
88 @@ -350,6 +350,18 @@ add_files (notmuch_database_t *notmuch,\r
89  \r
90         entry = fs_entries[i];\r
91  \r
92 +       /* Ignore any files/directories the user has configured to\r
93 +        * ignore.  We do this before dirent_type both for performance\r
94 +        * and because we don't care if dirent_type fails on entries\r
95 +        * that are explicitly ignored.\r
96 +        */\r
97 +       if (_entry_in_ignore_list (entry->d_name, state)) {\r
98 +           if (state->debug)\r
99 +               printf ("(D) add_files_recursive, pass 1: explicitly ignoring %s/%s\n",\r
100 +                       path, entry->d_name);\r
101 +           continue;\r
102 +       }\r
103 +\r
104         /* We only want to descend into directories (and symlinks to\r
105          * directories). */\r
106         entry_type = dirent_type (path, entry);\r
107 @@ -364,22 +376,14 @@ add_files (notmuch_database_t *notmuch,\r
108         }\r
109  \r
110         /* Ignore special directories to avoid infinite recursion.\r
111 -        * Also ignore the .notmuch directory, any "tmp" directory\r
112 -        * that appears within a maildir and files/directories\r
113 -        * the user has configured to be ignored.\r
114 +        * Also ignore the .notmuch directory and any "tmp" directory\r
115 +        * that appears within a maildir.\r
116          */\r
117         if (strcmp (entry->d_name, ".") == 0 ||\r
118             strcmp (entry->d_name, "..") == 0 ||\r
119             (is_maildir && strcmp (entry->d_name, "tmp") == 0) ||\r
120 -           strcmp (entry->d_name, ".notmuch") == 0 ||\r
121 -           _entry_in_ignore_list (entry->d_name, state))\r
122 -       {\r
123 -           if (_entry_in_ignore_list (entry->d_name, state) && state->debug)\r
124 -               printf ("(D) add_files_recursive, pass 1: explicitly ignoring %s/%s\n",\r
125 -                       path,\r
126 -                       entry->d_name);\r
127 +           strcmp (entry->d_name, ".notmuch") == 0)\r
128             continue;\r
129 -       }\r
130  \r
131         next = talloc_asprintf (notmuch, "%s/%s", path, entry->d_name);\r
132         status = add_files (notmuch, next, state);\r
133 diff --git a/test/new b/test/new\r
134 index 59892a7..8a76e34 100755\r
135 --- a/test/new\r
136 +++ b/test/new\r
137 @@ -192,7 +192,12 @@ touch "${MAIL_DIR}"/{one,one/two,one/two/three}/ignored_file\r
138  output=$(NOTMUCH_NEW --debug 2>&1 | sort)\r
139  test_expect_equal "$output" \\r
140  "(D) add_files_recursive, pass 1: explicitly ignoring ${MAIL_DIR}/.git\r
141 +(D) add_files_recursive, pass 1: explicitly ignoring ${MAIL_DIR}/.ignored_hidden_file\r
142 +(D) add_files_recursive, pass 1: explicitly ignoring ${MAIL_DIR}/ignored_file\r
143 +(D) add_files_recursive, pass 1: explicitly ignoring ${MAIL_DIR}/one/ignored_file\r
144 +(D) add_files_recursive, pass 1: explicitly ignoring ${MAIL_DIR}/one/two/ignored_file\r
145  (D) add_files_recursive, pass 1: explicitly ignoring ${MAIL_DIR}/one/two/three/.git\r
146 +(D) add_files_recursive, pass 1: explicitly ignoring ${MAIL_DIR}/one/two/three/ignored_file\r
147  (D) add_files_recursive, pass 2: explicitly ignoring ${MAIL_DIR}/.git\r
148  (D) add_files_recursive, pass 2: explicitly ignoring ${MAIL_DIR}/.ignored_hidden_file\r
149  (D) add_files_recursive, pass 2: explicitly ignoring ${MAIL_DIR}/ignored_file\r
150 @@ -204,7 +209,6 @@ No new mail."\r
151  \r
152  \r
153  test_begin_subtest "Don't stop for ignored broken symlinks"\r
154 -test_subtest_known_broken\r
155  notmuch config set new.ignore .git ignored_file .ignored_hidden_file broken_link\r
156  ln -s i_do_not_exist "${MAIL_DIR}"/broken_link\r
157  output=$(NOTMUCH_NEW 2>&1)\r
158 -- \r
159 1.7.10.4\r
160 \r