--- /dev/null
+Return-Path: <amdragon@mit.edu>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id 4C1D5431FAE\r
+ for <notmuch@notmuchmail.org>; Sat, 24 Nov 2012 21:26:02 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+ tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id 3qIDL1EweV0t for <notmuch@notmuchmail.org>;\r
+ Sat, 24 Nov 2012 21:26:00 -0800 (PST)\r
+Received: from dmz-mailsec-scanner-6.mit.edu (DMZ-MAILSEC-SCANNER-6.MIT.EDU\r
+ [18.7.68.35])\r
+ by olra.theworths.org (Postfix) with ESMTP id AF362431FC0\r
+ for <notmuch@notmuchmail.org>; Sat, 24 Nov 2012 21:26:00 -0800 (PST)\r
+X-AuditID: 12074423-b7fab6d0000008f9-06-50b1abe7d713\r
+Received: from mailhub-auth-4.mit.edu ( [18.7.62.39])\r
+ by dmz-mailsec-scanner-6.mit.edu (Symantec Messaging Gateway) with SMTP\r
+ id 85.6F.02297.7EBA1B05; Sun, 25 Nov 2012 00:25:59 -0500 (EST)\r
+Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
+ by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id qAP5PnRF014562; \r
+ Sun, 25 Nov 2012 00:25:49 -0500\r
+Received: from drake.dyndns.org\r
+ (209-6-116-242.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com\r
+ [209.6.116.242]) (authenticated bits=0)\r
+ (User authenticated as amdragon@ATHENA.MIT.EDU)\r
+ by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id qAP5PliO002625\r
+ (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+ Sun, 25 Nov 2012 00:25:48 -0500 (EST)\r
+Received: from amthrax by drake.dyndns.org with local (Exim 4.77)\r
+ (envelope-from <amdragon@mit.edu>)\r
+ id 1TcUix-0007dW-EQ; Sun, 25 Nov 2012 00:25:47 -0500\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 2/2] new: Skip ignored broken symlinks\r
+Date: Sun, 25 Nov 2012 00:25:45 -0500\r
+Message-Id: <1353821145-29182-3-git-send-email-amdragon@mit.edu>\r
+X-Mailer: git-send-email 1.7.10.4\r
+In-Reply-To: <1353821145-29182-1-git-send-email-amdragon@mit.edu>\r
+References: <1353821145-29182-1-git-send-email-amdragon@mit.edu>\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFtrEIsWRmVeSWpSXmKPExsUixG6nrvt89cYAg0n9qhbXb85kdmD0eLbq\r
+ FnMAYxSXTUpqTmZZapG+XQJXxr4Vh1gK3shUrD+ymqmB8ZZ4FyMnh4SAicTXt6fZIGwxiQv3\r
+ 1gPZXBxCAvsYJW5PPsUO4WxglJj54gwjhPOISWLdi21QmbmMEu+7/zGB9LMJaEhs27+cEcQW\r
+ EZCW2Hl3NmsXIwcHs4CaxJ8uFZCwsICZxN11fcwgNouAqsSp1mNgNq+Ag8TVDfeZIM5QlOh+\r
+ NoENpJVTwFGiebowSFgIqGTvtCWMExj5FzAyrGKUTcmt0s1NzMwpTk3WLU5OzMtLLdI108vN\r
+ LNFLTSndxAgOGhflHYx/DiodYhTgYFTi4b2RuDFAiDWxrLgy9xCjJAeTkiiv1jKgEF9Sfkpl\r
+ RmJxRnxRaU5q8SFGCQ5mJRFea1WgHG9KYmVValE+TEqag0VJnPdayk1/IYH0xJLU7NTUgtQi\r
+ mKwMB4eSBK8KMDqEBItS01Mr0jJzShDSTBycIMN5gIaD1fAWFyTmFmemQ+RPMSpKifNygyQE\r
+ QBIZpXlwvbCofsUoDvSKMC8fSBUPMCHAdb8CGswENPjp7HUgg0sSEVJSDYwyT+btnrdaIStO\r
+ saRR88AVsZM5n31e7BF89+oly4/OZz5PtaesVLATt1DzCm6pXXd0Qr6rp0F0b2vNQp9/Dnlc\r
+ 29K2J/zrS622zHkWvlayVy7tWfYcd1nlmXemeBw0DNuwZXbL571TNHsEppXs3/5wf9y1j+Ls\r
+ U76eKTgjuKjJpIKDy/MBe6kSS3FGoqEWc1FxIgCm1/kMxQIAAA==\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sun, 25 Nov 2012 05:26:02 -0000\r
+\r
+We now test for user ignore patterns before attempting to determine if\r
+a directory entry is itself a directory. As a result, we no longer\r
+abort for broken symlinks if the user has explicitly ignored them.\r
+\r
+This fixes the test added in the previous patch. It also slightly\r
+changes the debug output checked by another test of ignores.\r
+---\r
+ notmuch-new.c | 26 +++++++++++++++-----------\r
+ test/new | 6 +++++-\r
+ 2 files changed, 20 insertions(+), 12 deletions(-)\r
+\r
+diff --git a/notmuch-new.c b/notmuch-new.c\r
+index 56c4a6f..718a538 100644\r
+--- a/notmuch-new.c\r
++++ b/notmuch-new.c\r
+@@ -350,6 +350,18 @@ add_files (notmuch_database_t *notmuch,\r
+ \r
+ entry = fs_entries[i];\r
+ \r
++ /* Ignore any files/directories the user has configured to\r
++ * ignore. We do this before dirent_type both for performance\r
++ * and because we don't care if dirent_type fails on entries\r
++ * that are explicitly ignored.\r
++ */\r
++ if (_entry_in_ignore_list (entry->d_name, state)) {\r
++ if (state->debug)\r
++ printf ("(D) add_files_recursive, pass 1: explicitly ignoring %s/%s\n",\r
++ path, entry->d_name);\r
++ continue;\r
++ }\r
++\r
+ /* We only want to descend into directories (and symlinks to\r
+ * directories). */\r
+ entry_type = dirent_type (path, entry);\r
+@@ -364,22 +376,14 @@ add_files (notmuch_database_t *notmuch,\r
+ }\r
+ \r
+ /* Ignore special directories to avoid infinite recursion.\r
+- * Also ignore the .notmuch directory, any "tmp" directory\r
+- * that appears within a maildir and files/directories\r
+- * the user has configured to be ignored.\r
++ * Also ignore the .notmuch directory and any "tmp" directory\r
++ * that appears within a maildir.\r
+ */\r
+ if (strcmp (entry->d_name, ".") == 0 ||\r
+ strcmp (entry->d_name, "..") == 0 ||\r
+ (is_maildir && strcmp (entry->d_name, "tmp") == 0) ||\r
+- strcmp (entry->d_name, ".notmuch") == 0 ||\r
+- _entry_in_ignore_list (entry->d_name, state))\r
+- {\r
+- if (_entry_in_ignore_list (entry->d_name, state) && state->debug)\r
+- printf ("(D) add_files_recursive, pass 1: explicitly ignoring %s/%s\n",\r
+- path,\r
+- entry->d_name);\r
++ strcmp (entry->d_name, ".notmuch") == 0)\r
+ continue;\r
+- }\r
+ \r
+ next = talloc_asprintf (notmuch, "%s/%s", path, entry->d_name);\r
+ status = add_files (notmuch, next, state);\r
+diff --git a/test/new b/test/new\r
+index 59892a7..8a76e34 100755\r
+--- a/test/new\r
++++ b/test/new\r
+@@ -192,7 +192,12 @@ touch "${MAIL_DIR}"/{one,one/two,one/two/three}/ignored_file\r
+ output=$(NOTMUCH_NEW --debug 2>&1 | sort)\r
+ test_expect_equal "$output" \\r
+ "(D) add_files_recursive, pass 1: explicitly ignoring ${MAIL_DIR}/.git\r
++(D) add_files_recursive, pass 1: explicitly ignoring ${MAIL_DIR}/.ignored_hidden_file\r
++(D) add_files_recursive, pass 1: explicitly ignoring ${MAIL_DIR}/ignored_file\r
++(D) add_files_recursive, pass 1: explicitly ignoring ${MAIL_DIR}/one/ignored_file\r
++(D) add_files_recursive, pass 1: explicitly ignoring ${MAIL_DIR}/one/two/ignored_file\r
+ (D) add_files_recursive, pass 1: explicitly ignoring ${MAIL_DIR}/one/two/three/.git\r
++(D) add_files_recursive, pass 1: explicitly ignoring ${MAIL_DIR}/one/two/three/ignored_file\r
+ (D) add_files_recursive, pass 2: explicitly ignoring ${MAIL_DIR}/.git\r
+ (D) add_files_recursive, pass 2: explicitly ignoring ${MAIL_DIR}/.ignored_hidden_file\r
+ (D) add_files_recursive, pass 2: explicitly ignoring ${MAIL_DIR}/ignored_file\r
+@@ -204,7 +209,6 @@ No new mail."\r
+ \r
+ \r
+ test_begin_subtest "Don't stop for ignored broken symlinks"\r
+-test_subtest_known_broken\r
+ notmuch config set new.ignore .git ignored_file .ignored_hidden_file broken_link\r
+ ln -s i_do_not_exist "${MAIL_DIR}"/broken_link\r
+ output=$(NOTMUCH_NEW 2>&1)\r
+-- \r
+1.7.10.4\r
+\r