--- /dev/null
+Return-Path: <bremner@tesseract.cs.unb.ca>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id 350C26DE0FF1\r
+ for <notmuch@notmuchmail.org>; Mon, 3 Aug 2015 23:50:59 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.146\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.146 tagged_above=-999 required=5 tests=[AWL=0.136, \r
+ T_HEADER_FROM_DIFFERENT_DOMAINS=0.01] autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id bV9WZMaD5piQ for <notmuch@notmuchmail.org>;\r
+ Mon, 3 Aug 2015 23:50:57 -0700 (PDT)\r
+Received: from gitolite.debian.net (gitolite.debian.net [87.98.215.224])\r
+ by arlo.cworth.org (Postfix) with ESMTPS id 828E06DE1557\r
+ for <notmuch@notmuchmail.org>; Mon, 3 Aug 2015 23:50:57 -0700 (PDT)\r
+Received: from remotemail by gitolite.debian.net with local (Exim 4.80)\r
+ (envelope-from <bremner@tesseract.cs.unb.ca>)\r
+ id 1ZMW2l-0000Qc-Pd; Tue, 04 Aug 2015 06:49:47 +0000\r
+Received: (nullmailer pid 17855 invoked by uid 1000); Tue, 04 Aug 2015\r
+ 06:48:55 -0000\r
+From: David Bremner <david@tethera.net>\r
+To: Tomi Ollila <tomi.ollila@iki.fi>, David Bremner <david@tethera.net>\r
+Subject: [PATCH 2/3] cli/new: add more debugging output\r
+Date: Tue, 4 Aug 2015 08:48:33 +0200\r
+Message-Id: <1438670914-17203-3-git-send-email-david@tethera.net>\r
+X-Mailer: git-send-email 2.1.4\r
+In-Reply-To: <1438670914-17203-1-git-send-email-david@tethera.net>\r
+References: <m2a8ua2gm9.fsf@guru.guru-group.fi>\r
+ <1438670914-17203-1-git-send-email-david@tethera.net>\r
+Cc: notmuch@notmuchmail.org\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.18\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: Tue, 04 Aug 2015 06:50:59 -0000\r
+\r
+Try to narrow down what part of the code adds files and directories to\r
+the queue(s) to be deleted.\r
+\r
+Update one test. The output is slightly confusing, but I believe it is\r
+correct, resulting from a directory being discovered but containing only ignored files.\r
+---\r
+ notmuch-new.c | 14 ++++++++++++++\r
+ test/T050-new.sh | 1 +\r
+ 2 files changed, 15 insertions(+)\r
+\r
+diff --git a/notmuch-new.c b/notmuch-new.c\r
+index 8ff1ade..ee786a3 100644\r
+--- a/notmuch-new.c\r
++++ b/notmuch-new.c\r
+@@ -528,6 +528,10 @@ add_files (notmuch_database_t *notmuch,\r
+ "%s/%s", path,\r
+ notmuch_filenames_get (db_files));\r
+ \r
++ if (state->debug)\r
++ printf ("(D) add_files_recursive, pass 2: queuing passed file %s for deletion from database\n",\r
++ absolute);\r
++\r
+ _filename_list_add (state->removed_files, absolute);\r
+ \r
+ notmuch_filenames_move_to_next (db_files);\r
+@@ -542,6 +546,9 @@ add_files (notmuch_database_t *notmuch,\r
+ {\r
+ char *absolute = talloc_asprintf (state->removed_directories,\r
+ "%s/%s", path, filename);\r
++ if (state->debug)\r
++ printf ("(D) add_files_recursive, pass 2: queuing passed directory %s for deletion from database\n",\r
++ absolute);\r
+ \r
+ _filename_list_add (state->removed_directories, absolute);\r
+ }\r
+@@ -610,6 +617,9 @@ add_files (notmuch_database_t *notmuch,\r
+ char *absolute = talloc_asprintf (state->removed_files,\r
+ "%s/%s", path,\r
+ notmuch_filenames_get (db_files));\r
++ if (state->debug)\r
++ printf ("(D) add_files_recursive, pass 3: queuing leftover file %s for deletion from database\n",\r
++ absolute);\r
+ \r
+ _filename_list_add (state->removed_files, absolute);\r
+ \r
+@@ -622,6 +632,10 @@ add_files (notmuch_database_t *notmuch,\r
+ "%s/%s", path,\r
+ notmuch_filenames_get (db_subdirs));\r
+ \r
++ if (state->debug)\r
++ printf ("(D) add_files_recursive, pass 3: queuing leftover directory %s for deletion from database\n",\r
++ absolute);\r
++\r
+ _filename_list_add (state->removed_directories, absolute);\r
+ \r
+ notmuch_filenames_move_to_next (db_subdirs);\r
+diff --git a/test/T050-new.sh b/test/T050-new.sh\r
+index 66ea10f..ab15ca1 100755\r
+--- a/test/T050-new.sh\r
++++ b/test/T050-new.sh\r
+@@ -238,6 +238,7 @@ test_expect_equal "$output" \\r
+ (D) add_files_recursive, pass 2: explicitly ignoring ${MAIL_DIR}/one/two/ignored_file\r
+ (D) add_files_recursive, pass 2: explicitly ignoring ${MAIL_DIR}/one/two/three/.git\r
+ (D) add_files_recursive, pass 2: explicitly ignoring ${MAIL_DIR}/one/two/three/ignored_file\r
++(D) add_files_recursive, pass 3: queuing leftover directory ${MAIL_DIR}/two for deletion from database\r
+ No new mail."\r
+ \r
+ \r
+-- \r
+2.1.4\r
+\r