--- /dev/null
+Return-Path: <david@tethera.net>\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 0EF45431FDF\r
+ for <notmuch@notmuchmail.org>; Tue, 11 Mar 2014 16:10:52 -0700 (PDT)\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 en4FYipgPrcJ for <notmuch@notmuchmail.org>;\r
+ Tue, 11 Mar 2014 16:10:48 -0700 (PDT)\r
+Received: from yantan.tethera.net (yantan.tethera.net [199.188.72.155])\r
+ (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 9A7B2429E29\r
+ for <notmuch@notmuchmail.org>; Tue, 11 Mar 2014 16:10:48 -0700 (PDT)\r
+Received: from remotemail by yantan.tethera.net with local (Exim 4.80)\r
+ (envelope-from <david@tethera.net>)\r
+ id 1WNVou-00021R-6j; Tue, 11 Mar 2014 20:10:48 -0300\r
+Received: (nullmailer pid 923 invoked by uid 1000); Tue, 11 Mar 2014 23:10:44\r
+ -0000\r
+From: David Bremner <david@tethera.net>\r
+To: notmuch@notmuchmail.org\r
+Subject: Re: v6 of boolean folder patches\r
+In-Reply-To: <1394578900-25618-1-git-send-email-david@tethera.net>\r
+References: <1394578900-25618-1-git-send-email-david@tethera.net>\r
+User-Agent: Notmuch/0.17+120~gccab40f (http://notmuchmail.org) Emacs/24.3.1\r
+ (x86_64-pc-linux-gnu)\r
+Date: Tue, 11 Mar 2014 20:10:44 -0300\r
+Message-ID: <87ha7472mj.fsf@zancas.localnet>\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: Tue, 11 Mar 2014 23:10:52 -0000\r
+\r
+David Bremner <david@tethera.net> writes:\r
+\r
+>\r
+> Here's a diffstat\r
+>\r
+> test/T090-search-output.sh | 112 +++++++++++++-------------\r
+> test/T530-upgrade.sh | 26 +++---\r
+> test/test-databases/Makefile.local | 2 +-\r
+> test/test-databases/database-v1.tar.xz.sha256 | 1 +\r
+> test/test-databases/folders-v1.tar.xz.sha256 | 1 -\r
+> test/test-lib.sh | 6 ++\r
+> 6 files changed, 77 insertions(+), 71 deletions(-)\r
+\r
+by request, a real diff\r
+\r
+diff --git a/test/T090-search-output.sh b/test/T090-search-output.sh\r
+index e0bf8c1..947d572 100755\r
+--- a/test/T090-search-output.sh\r
++++ b/test/T090-search-output.sh\r
+@@ -181,67 +181,71 @@ EOF\r
+ test_expect_equal_file OUTPUT EXPECTED\r
+ \r
+ test_begin_subtest "--output=files"\r
+-notmuch search --output=files '*' | notmuch_search_files_sanitize >OUTPUT\r
++notmuch search --output=files '*' | notmuch_search_files_sanitize | sort >OUTPUT\r
+ cat <<EOF >EXPECTED\r
+-MAIL_DIR/cur/52:2,\r
+-MAIL_DIR/cur/53:2,\r
+-MAIL_DIR/cur/50:2,\r
+-MAIL_DIR/cur/49:2,\r
+-MAIL_DIR/cur/48:2,\r
+-MAIL_DIR/cur/47:2,\r
+-MAIL_DIR/cur/46:2,\r
+-MAIL_DIR/cur/45:2,\r
+-MAIL_DIR/cur/44:2,\r
+-MAIL_DIR/cur/43:2,\r
+-MAIL_DIR/cur/42:2,\r
+-MAIL_DIR/cur/41:2,\r
+-MAIL_DIR/cur/40:2,\r
+-MAIL_DIR/cur/39:2,\r
+-MAIL_DIR/cur/38:2,\r
+-MAIL_DIR/cur/37:2,\r
+-MAIL_DIR/cur/36:2,\r
+-MAIL_DIR/cur/35:2,\r
+-MAIL_DIR/cur/34:2,\r
+-MAIL_DIR/cur/33:2,\r
+-MAIL_DIR/cur/32:2,\r
+-MAIL_DIR/cur/31:2,\r
+-MAIL_DIR/cur/30:2,\r
+-MAIL_DIR/cur/29:2,\r
+-MAIL_DIR/bar/baz/new/28:2,\r
+-MAIL_DIR/bar/baz/new/27:2,\r
+-MAIL_DIR/bar/baz/cur/26:2,\r
+-MAIL_DIR/bar/baz/cur/25:2,\r
+-MAIL_DIR/bar/baz/24:2,\r
++MAIL_DIR/01:2,\r
++MAIL_DIR/02:2,\r
++MAIL_DIR/bar/17:2,\r
++MAIL_DIR/bar/18:2,\r
++MAIL_DIR/bar/baz/05:2,\r
+ MAIL_DIR/bar/baz/23:2,\r
+-MAIL_DIR/bar/new/22:2,\r
+-MAIL_DIR/bar/new/21:2,\r
++MAIL_DIR/bar/baz/24:2,\r
++MAIL_DIR/bar/baz/cur/25:2,\r
++MAIL_DIR/bar/baz/cur/26:2,\r
++MAIL_DIR/bar/baz/new/27:2,\r
++MAIL_DIR/bar/baz/new/28:2,\r
+ MAIL_DIR/bar/cur/19:2,\r
+-MAIL_DIR/bar/18:2,\r
+-MAIL_DIR/cur/51:2,\r
+ MAIL_DIR/bar/cur/20:2,\r
+-MAIL_DIR/bar/17:2,\r
+-MAIL_DIR/foo/baz/new/16:2,\r
+-MAIL_DIR/foo/baz/new/15:2,\r
+-MAIL_DIR/foo/baz/cur/14:2,\r
+-MAIL_DIR/foo/baz/cur/13:2,\r
+-MAIL_DIR/foo/baz/12:2,\r
++MAIL_DIR/bar/new/21:2,\r
++MAIL_DIR/bar/new/22:2,\r
++MAIL_DIR/cur/29:2,\r
++MAIL_DIR/cur/30:2,\r
++MAIL_DIR/cur/31:2,\r
++MAIL_DIR/cur/32:2,\r
++MAIL_DIR/cur/33:2,\r
++MAIL_DIR/cur/34:2,\r
++MAIL_DIR/cur/35:2,\r
++MAIL_DIR/cur/36:2,\r
++MAIL_DIR/cur/37:2,\r
++MAIL_DIR/cur/38:2,\r
++MAIL_DIR/cur/39:2,\r
++MAIL_DIR/cur/40:2,\r
++MAIL_DIR/cur/41:2,\r
++MAIL_DIR/cur/42:2,\r
++MAIL_DIR/cur/43:2,\r
++MAIL_DIR/cur/44:2,\r
++MAIL_DIR/cur/45:2,\r
++MAIL_DIR/cur/46:2,\r
++MAIL_DIR/cur/47:2,\r
++MAIL_DIR/cur/48:2,\r
++MAIL_DIR/cur/49:2,\r
++MAIL_DIR/cur/50:2,\r
++MAIL_DIR/cur/51:2,\r
++MAIL_DIR/cur/52:2,\r
++MAIL_DIR/cur/53:2,\r
++MAIL_DIR/foo/06:2,\r
+ MAIL_DIR/foo/baz/11:2,\r
+-MAIL_DIR/foo/new/10:2,\r
+-MAIL_DIR/foo/new/09:2,\r
++MAIL_DIR/foo/baz/12:2,\r
++MAIL_DIR/foo/baz/cur/13:2,\r
++MAIL_DIR/foo/baz/cur/14:2,\r
++MAIL_DIR/foo/baz/new/15:2,\r
++MAIL_DIR/foo/baz/new/16:2,\r
++MAIL_DIR/foo/cur/07:2,\r
+ MAIL_DIR/foo/cur/08:2,\r
+-MAIL_DIR/foo/06:2,\r
+-MAIL_DIR/bar/baz/05:2,\r
+-MAIL_DIR/new/04:2,\r
+ MAIL_DIR/foo/new/03:2,\r
+-MAIL_DIR/foo/cur/07:2,\r
+-MAIL_DIR/02:2,\r
+-MAIL_DIR/01:2,\r
++MAIL_DIR/foo/new/09:2,\r
++MAIL_DIR/foo/new/10:2,\r
++MAIL_DIR/new/04:2,\r
+ EOF\r
+ test_expect_equal_file OUTPUT EXPECTED\r
+ \r
++dup1=$(notmuch search --output=files id:20091117232137.GA7669@griffis1.net | head -n 1 | sed -e "s,$MAIL_DIR,MAIL_DIR,")\r
++dup2=$(notmuch search --output=files id:20091117232137.GA7669@griffis1.net | tail -n 1 | sed -e "s,$MAIL_DIR,MAIL_DIR,")\r
++\r
+ test_begin_subtest "--output=files --duplicate=1"\r
+-notmuch search --output=files --duplicate=1 '*' | notmuch_search_files_sanitize >OUTPUT\r
+-cat <<EOF >EXPECTED\r
++notmuch search --output=files --duplicate=1 '*' | notmuch_search_files_sanitize | sort >OUTPUT\r
++cat <<EOF | sort >EXPECTED\r
++$dup1\r
+ MAIL_DIR/cur/52:2,\r
+ MAIL_DIR/cur/53:2,\r
+ MAIL_DIR/cur/50:2,\r
+@@ -275,7 +279,6 @@ MAIL_DIR/bar/baz/23:2,\r
+ MAIL_DIR/bar/new/22:2,\r
+ MAIL_DIR/bar/new/21:2,\r
+ MAIL_DIR/bar/cur/19:2,\r
+-MAIL_DIR/bar/18:2,\r
+ MAIL_DIR/bar/cur/20:2,\r
+ MAIL_DIR/bar/17:2,\r
+ MAIL_DIR/foo/baz/new/16:2,\r
+@@ -298,8 +301,9 @@ EOF\r
+ test_expect_equal_file OUTPUT EXPECTED\r
+ \r
+ test_begin_subtest "--output=files --format=json"\r
+-notmuch search --format=json --output=files '*' | notmuch_search_files_sanitize >OUTPUT\r
+-cat <<EOF >EXPECTED\r
++notmuch search --format=json --output=files '*' | notmuch_search_files_sanitize \\r
++ | test_sort_json >OUTPUT\r
++cat <<EOF | test_sort_json >EXPECTED\r
+ ["MAIL_DIR/cur/52:2,",\r
+ "MAIL_DIR/cur/53:2,",\r
+ "MAIL_DIR/cur/50:2,",\r
+@@ -359,7 +363,7 @@ test_expect_equal_file OUTPUT EXPECTED\r
+ test_begin_subtest "--output=files --format=json --duplicate=2"\r
+ notmuch search --format=json --output=files --duplicate=2 '*' | notmuch_search_files_sanitize >OUTPUT\r
+ cat <<EOF >EXPECTED\r
+-["MAIL_DIR/cur/51:2,"]\r
++["$dup2"]\r
+ EOF\r
+ test_expect_equal_file OUTPUT EXPECTED\r
+ \r
+diff --git a/test/T530-upgrade.sh b/test/T530-upgrade.sh\r
+index 56cee02..67bbf31 100755\r
+--- a/test/T530-upgrade.sh\r
++++ b/test/T530-upgrade.sh\r
+@@ -3,7 +3,7 @@ test_description="database upgrade"\r
+ \r
+ . ./test-lib.sh\r
+ \r
+-dbtarball=folders-v1.tar.xz\r
++dbtarball=database-v1.tar.xz\r
+ \r
+ # XXX: Accomplish the same with test lib helpers\r
+ if [ ! -e ${TEST_DIRECTORY}/test-databases/${dbtarball} ]; then\r
+diff --git a/test/test-databases/Makefile.local b/test/test-databases/Makefile.local\r
+index e777ada..0572e78 100644\r
+--- a/test/test-databases/Makefile.local\r
++++ b/test/test-databases/Makefile.local\r
+@@ -4,7 +4,7 @@ TEST_DATABASE_MIRROR=http://notmuchmail.org/releases/test-databases\r
+ \r
+ dir := test/test-databases\r
+ \r
+-test_databases := $(dir)/folders-v1.tar.xz\r
++test_databases := $(dir)/database-v1.tar.xz\r
+ \r
+ %.tar.xz:\r
+ wget -nv -O $@ ${TEST_DATABASE_MIRROR}/$(notdir $@);\r
+diff --git a/test/test-databases/database-v1.tar.xz.sha256 b/test/test-databases/database-v1.tar.xz.sha256\r
+new file mode 100644\r
+index 0000000..2cc4f96\r
+--- /dev/null\r
++++ b/test/test-databases/database-v1.tar.xz.sha256\r
+@@ -0,0 +1 @@\r
++4299e051b10e1fa7b33ea2862790a09ebfe96859681804e5251e130f800e69d2 database-v1.tar.xz\r
+diff --git a/test/test-databases/folders-v1.tar.xz.sha256 b/test/test-databases/folders-v1.tar.xz.sha256\r
+deleted file mode 100644\r
+index 01ad79d..0000000\r
+--- a/test/test-databases/folders-v1.tar.xz.sha256\r
++++ /dev/null\r
+@@ -1 +0,0 @@\r
+-ace8a61216756b90a421e23d03910e1228bcb910e197c35e51e29f2cf57b37d9 folders-v1.tar.xz\r
+diff --git a/test/test-lib.sh b/test/test-lib.sh\r
+index 837c669..8697d6a 100644\r
+--- a/test/test-lib.sh\r
++++ b/test/test-lib.sh\r
+@@ -622,6 +622,12 @@ test_expect_equal_json () {\r
+ test_expect_equal "$output" "$expected" "$@"\r
+ }\r
+ \r
++# Sort the top-level list of JSON data from stdin.\r
++test_sort_json () {\r
++ PYTHONIOENCODING=utf-8 python -c \\r
++ "import sys, json; json.dump(sorted(json.load(sys.stdin)),sys.stdout)"\r
++}\r
++\r
+ test_emacs_expect_t () {\r
+ test "$#" = 2 && { prereq=$1; shift; } || prereq=\r
+ test "$#" = 1 ||\r