1 Return-Path: <bremner@tethera.net>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id B8816431FC0
\r
6 for <notmuch@notmuchmail.org>; Sat, 22 Mar 2014 19:26:43 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id hYMR7G+1ocAC for <notmuch@notmuchmail.org>;
\r
16 Sat, 22 Mar 2014 19:26:38 -0700 (PDT)
\r
17 Received: from yantan.tethera.net (yantan.tethera.net [199.188.72.155])
\r
18 (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))
\r
19 (No client certificate requested)
\r
20 by olra.theworths.org (Postfix) with ESMTPS id B9331431FC2
\r
21 for <notmuch@notmuchmail.org>; Sat, 22 Mar 2014 19:26:37 -0700 (PDT)
\r
22 Received: from remotemail by yantan.tethera.net with local (Exim 4.80)
\r
23 (envelope-from <bremner@tethera.net>)
\r
24 id 1WRY7R-0008P9-CR; Sat, 22 Mar 2014 23:26:37 -0300
\r
25 Received: (nullmailer pid 2941 invoked by uid 1000); Sun, 23 Mar 2014
\r
27 From: David Bremner <david@tethera.net>
\r
28 To: notmuch@notmuchmail.org
\r
29 Subject: [PATCH 2/2] notmuch-new: block database upgrades in default
\r
31 Date: Sat, 22 Mar 2014 23:26:13 -0300
\r
32 Message-Id: <1395541573-2417-3-git-send-email-david@tethera.net>
\r
33 X-Mailer: git-send-email 1.9.0
\r
34 In-Reply-To: <1395541573-2417-1-git-send-email-david@tethera.net>
\r
35 References: <87bnx4jyyp.fsf@servo.finestructure.net>
\r
36 <1395541573-2417-1-git-send-email-david@tethera.net>
\r
37 X-BeenThere: notmuch@notmuchmail.org
\r
38 X-Mailman-Version: 2.1.13
\r
40 List-Id: "Use and development of the notmuch mail system."
\r
41 <notmuch.notmuchmail.org>
\r
42 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
43 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
44 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
45 List-Post: <mailto:notmuch@notmuchmail.org>
\r
46 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
47 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
48 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
49 X-List-Received-Date: Sun, 23 Mar 2014 02:26:43 -0000
\r
51 People who prefer the current behaviour can set the configuration
\r
52 variable and forget it.
\r
54 notmuch-new.c | 9 +++++++++
\r
55 test/T530-upgrade.sh | 11 +++++++++++
\r
56 2 files changed, 20 insertions(+)
\r
58 diff --git a/notmuch-new.c b/notmuch-new.c
\r
59 index 82acf69..c6a15b0 100644
\r
62 @@ -989,6 +989,15 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[])
\r
63 return EXIT_FAILURE;
\r
65 if (notmuch_database_needs_upgrade (notmuch)) {
\r
66 + if (strcasecmp(notmuch_config_get_database_upgrades (config), "yes") != 0) {
\r
68 + "Database upgrade needed. Please enable with\n\n"
\r
69 + " notmuch config set database.upgrades yes\n\n"
\r
70 + "after taking appropriate precautions.\n");
\r
72 + return EXIT_FAILURE;
\r
75 if (add_files_state.verbosity >= VERBOSITY_NORMAL)
\r
76 printf ("Welcome to a new version of notmuch! Your database will now be upgraded.\n");
\r
77 gettimeofday (&add_files_state.tv_start, NULL);
\r
78 diff --git a/test/T530-upgrade.sh b/test/T530-upgrade.sh
\r
79 index 67bbf31..00dcb1e 100755
\r
80 --- a/test/T530-upgrade.sh
\r
81 +++ b/test/T530-upgrade.sh
\r
82 @@ -25,8 +25,19 @@ test_begin_subtest "path: search does not work with old database version"
\r
83 output=$(notmuch search path:foo)
\r
84 test_expect_equal "$output" ""
\r
86 +test_begin_subtest "database upgrade blocked by default config"
\r
87 +output=$(notmuch new 2>&1)
\r
88 +test_expect_equal "$output" "\
\r
89 +Database upgrade needed. Please enable with
\r
91 + notmuch config set database.upgrades yes
\r
93 +after taking appropriate precautions."
\r
95 test_begin_subtest "database upgrade from format version 1"
\r
96 +notmuch config set database.upgrades yes
\r
97 output=$(notmuch new)
\r
99 test_expect_equal "$output" "\
\r
100 Welcome to a new version of notmuch! Your database will now be upgraded.
\r
101 Your notmuch database has now been upgraded to database format version 2.
\r