--- /dev/null
+Return-Path: <bremner@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 B8816431FC0\r
+ for <notmuch@notmuchmail.org>; Sat, 22 Mar 2014 19:26:43 -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 hYMR7G+1ocAC for <notmuch@notmuchmail.org>;\r
+ Sat, 22 Mar 2014 19:26:38 -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 B9331431FC2\r
+ for <notmuch@notmuchmail.org>; Sat, 22 Mar 2014 19:26:37 -0700 (PDT)\r
+Received: from remotemail by yantan.tethera.net with local (Exim 4.80)\r
+ (envelope-from <bremner@tethera.net>)\r
+ id 1WRY7R-0008P9-CR; Sat, 22 Mar 2014 23:26:37 -0300\r
+Received: (nullmailer pid 2941 invoked by uid 1000); Sun, 23 Mar 2014\r
+ 02:26:26 -0000\r
+From: David Bremner <david@tethera.net>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 2/2] notmuch-new: block database upgrades in default\r
+ configuration.\r
+Date: Sat, 22 Mar 2014 23:26:13 -0300\r
+Message-Id: <1395541573-2417-3-git-send-email-david@tethera.net>\r
+X-Mailer: git-send-email 1.9.0\r
+In-Reply-To: <1395541573-2417-1-git-send-email-david@tethera.net>\r
+References: <87bnx4jyyp.fsf@servo.finestructure.net>\r
+ <1395541573-2417-1-git-send-email-david@tethera.net>\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 Mar 2014 02:26:43 -0000\r
+\r
+People who prefer the current behaviour can set the configuration\r
+variable and forget it.\r
+---\r
+ notmuch-new.c | 9 +++++++++\r
+ test/T530-upgrade.sh | 11 +++++++++++\r
+ 2 files changed, 20 insertions(+)\r
+\r
+diff --git a/notmuch-new.c b/notmuch-new.c\r
+index 82acf69..c6a15b0 100644\r
+--- a/notmuch-new.c\r
++++ b/notmuch-new.c\r
+@@ -989,6 +989,15 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[])\r
+ return EXIT_FAILURE;\r
+ \r
+ if (notmuch_database_needs_upgrade (notmuch)) {\r
++ if (strcasecmp(notmuch_config_get_database_upgrades (config), "yes") != 0) {\r
++ fprintf (stderr,\r
++ "Database upgrade needed. Please enable with\n\n"\r
++ " notmuch config set database.upgrades yes\n\n"\r
++ "after taking appropriate precautions.\n");\r
++\r
++ return EXIT_FAILURE;\r
++ }\r
++\r
+ if (add_files_state.verbosity >= VERBOSITY_NORMAL)\r
+ printf ("Welcome to a new version of notmuch! Your database will now be upgraded.\n");\r
+ gettimeofday (&add_files_state.tv_start, NULL);\r
+diff --git a/test/T530-upgrade.sh b/test/T530-upgrade.sh\r
+index 67bbf31..00dcb1e 100755\r
+--- a/test/T530-upgrade.sh\r
++++ b/test/T530-upgrade.sh\r
+@@ -25,8 +25,19 @@ test_begin_subtest "path: search does not work with old database version"\r
+ output=$(notmuch search path:foo)\r
+ test_expect_equal "$output" ""\r
+ \r
++test_begin_subtest "database upgrade blocked by default config"\r
++output=$(notmuch new 2>&1)\r
++test_expect_equal "$output" "\\r
++Database upgrade needed. Please enable with\r
++\r
++ notmuch config set database.upgrades yes\r
++\r
++after taking appropriate precautions."\r
++\r
+ test_begin_subtest "database upgrade from format version 1"\r
++notmuch config set database.upgrades yes\r
+ output=$(notmuch new)\r
++\r
+ test_expect_equal "$output" "\\r
+ Welcome to a new version of notmuch! Your database will now be upgraded.\r
+ Your notmuch database has now been upgraded to database format version 2.\r
+-- \r
+1.9.0\r
+\r