--- /dev/null
+Return-Path: <tomi.ollila@iki.fi>\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 30DC2431FD6\r
+ for <notmuch@notmuchmail.org>; Sun, 23 Feb 2014 15:29:10 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+ 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 VpllNKcLooni for <notmuch@notmuchmail.org>;\r
+ Sun, 23 Feb 2014 15:29:04 -0800 (PST)\r
+Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
+ by olra.theworths.org (Postfix) with ESMTP id 9C05A431FCF\r
+ for <notmuch@notmuchmail.org>; Sun, 23 Feb 2014 15:29:03 -0800 (PST)\r
+Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
+ by guru.guru-group.fi (Postfix) with ESMTP id A67A4100064;\r
+ Mon, 24 Feb 2014 01:28:57 +0200 (EET)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: Jani Nikula <jani@nikula.org>, notmuch@notmuchmail.org,\r
+ Mark Walters <markwalters1009@gmail.com>\r
+Subject: Re: [PATCH] test: test folder renames\r
+In-Reply-To: <1393191650-28333-1-git-send-email-jani@nikula.org>\r
+References: <87siray6th.fsf@qmul.ac.uk>\r
+ <1393191650-28333-1-git-send-email-jani@nikula.org>\r
+User-Agent: Notmuch/0.17+108~gb327c11 (http://notmuchmail.org) Emacs/24.3.1\r
+ (x86_64-unknown-linux-gnu)\r
+X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
+ $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
+ !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
+Date: Mon, 24 Feb 2014 01:28:57 +0200\r
+Message-ID: <m2ob1xpfwm.fsf@guru.guru-group.fi>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\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, 23 Feb 2014 23:29:10 -0000\r
+\r
+On Sun, Feb 23 2014, Jani Nikula <jani@nikula.org> wrote:\r
+\r
+> On Sun, 23 Feb 2014, Mark Walters <markwalters1009@gmail.com> wrote:\r
+>> I was experimenting with letting notmuch new take an argument to tell it\r
+>> to scan only a particular directory (and sub-directories) for new\r
+>> messages. I came across the following strange behaviour which is also\r
+>> present in master (with a fresh database)\r
+>>\r
+>> I have a bunch of maildirs in /home/mail: so folders .mail.foo/\r
+>> .mail.bar/ each of which has cur/new/tmp and all the messages are in\r
+>> cur.\r
+>>\r
+>> If I do mv .mail.foo .mail.bar/ and run notmuch new I get the expected\r
+>> lots of renames (900 or so in the case I was trying). But if I then do\r
+>> mv .mail.bar/.mail.foo . and run notmuch new almost all the messages get\r
+>> removed (but 30 renames do get detected). If I then do touch .mail.foo/*\r
+>> the messages get found again\r
+>>\r
+>> I am guessing the 30 renames might be because those 30 have duplicates\r
+>> somewhere else.\r
+>>\r
+>> But the other behaviour has me puzzled.\r
+>\r
+> This test reproduces the problem for me, but it's not\r
+> deterministic. With the loop, I get roughly one fail per test run:\r
+>\r
+> FAIL Rename folder back\r
+> --- T051-new-renames.27.expected 2014-02-23 21:37:10.121774241 +0000\r
+> +++ T051-new-renames.27.output 2014-02-23 21:37:10.121774241 +0000\r
+> @@ -1 +1 @@\r
+> -No new mail. Detected 10 file renames.\r
+> +No new mail. Removed 10 messages.\r
+> FAIL Files remain the same\r
+> --- T051-new-renames.28.expected 2014-02-23 21:37:10.133774652 +0000\r
+> +++ T051-new-renames.28.output 2014-02-23 21:37:10.133774652 +0000\r
+> @@ -1,13 +1,3 @@\r
+> -/path/to/test/tmp.T051-new-renames/mail/foo/msg-121\r
+> -/path/to/test/tmp.T051-new-renames/mail/foo/msg-122\r
+> -/path/to/test/tmp.T051-new-renames/mail/foo/msg-123\r
+> -/path/to/test/tmp.T051-new-renames/mail/foo/msg-124\r
+> -/path/to/test/tmp.T051-new-renames/mail/foo/msg-125\r
+> -/path/to/test/tmp.T051-new-renames/mail/foo/msg-126\r
+> -/path/to/test/tmp.T051-new-renames/mail/foo/msg-127\r
+> -/path/to/test/tmp.T051-new-renames/mail/foo/msg-128\r
+> -/path/to/test/tmp.T051-new-renames/mail/foo/msg-129\r
+> -/path/to/test/tmp.T051-new-renames/mail/foo/msg-130\r
+> /path/to/test/tmp.T051-new-renames/mail/bar/msg-131\r
+> /path/to/test/tmp.T051-new-renames/mail/bar/msg-132\r
+> /path/to/test/tmp.T051-new-renames/mail/bar/msg-133\r
+>\r
+> I'm as puzzled as you are.\r
+\r
+find /path/to/test/tmp.T051-new-renames/ might show what is the order\r
+or 'foo' and 'bar' directories there. the order might be arbitrary\r
+-- it surely is not alphabetical and it might not be the order\r
+created...\r
+\r
+The order should not matter -- and maybe it didn't and some change\r
+made that matter... \r
+\r
+I'd test now but I should be ZZZ :D\r
+\r
+>\r
+> BR,\r
+> Jani.\r
+\r
+Tomi\r
+\r
+> ---\r
+> test/T051-new-renames.sh | 40 ++++++++++++++++++++++++++++++++++++++++\r
+> 1 file changed, 40 insertions(+)\r
+> create mode 100755 test/T051-new-renames.sh\r
+>\r
+> diff --git a/test/T051-new-renames.sh b/test/T051-new-renames.sh\r
+> new file mode 100755\r
+> index 000000000000..febe006f5888\r
+> --- /dev/null\r
+> +++ b/test/T051-new-renames.sh\r
+> @@ -0,0 +1,40 @@\r
+> +#!/usr/bin/env bash\r
+> +test_description='"notmuch new" with directory renames'\r
+> +. ./test-lib.sh\r
+> +\r
+> +for loop in `seq 10`; do\r
+> +\r
+> +rm -rf ${MAIL_DIR}\r
+> +\r
+> +for i in `seq 10`; do\r
+> + generate_message '[dir]=foo' '[subject]="Message foo $i"'\r
+> +done\r
+> +\r
+> +for i in `seq 10`; do\r
+> + generate_message '[dir]=bar' '[subject]="Message bar $i"'\r
+> +done\r
+> +\r
+> +test_begin_subtest "Index the messages, round $loop"\r
+> +output=$(NOTMUCH_NEW)\r
+> +test_expect_equal "$output" "Added 20 new messages to the database."\r
+> +\r
+> +all_files=$(notmuch search --output=files \*)\r
+> +count_foo=$(notmuch count folder:foo)\r
+> +\r
+> +test_begin_subtest "Rename folder"\r
+> +mv ${MAIL_DIR}/foo ${MAIL_DIR}/baz\r
+> +output=$(NOTMUCH_NEW)\r
+> +test_expect_equal "$output" "No new mail. Detected $count_foo file renames."\r
+> +\r
+> +test_begin_subtest "Rename folder back"\r
+> +mv ${MAIL_DIR}/baz ${MAIL_DIR}/foo\r
+> +output=$(NOTMUCH_NEW)\r
+> +test_expect_equal "$output" "No new mail. Detected $count_foo file renames."\r
+> +\r
+> +test_begin_subtest "Files remain the same"\r
+> +output=$(notmuch search --output=files \*)\r
+> +test_expect_equal "$output" "$all_files"\r
+> +\r
+> +done\r
+> +\r
+> +test_done\r
+> -- \r
+> 1.8.5.3\r
+>\r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r