--- /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 46930431FCB\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 yW2CJFI7qJti for <notmuch@notmuchmail.org>;\r
+ Sat, 22 Mar 2014 19:26:36 -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 75538431FC0\r
+ for <notmuch@notmuchmail.org>; Sat, 22 Mar 2014 19:26:36 -0700 (PDT)\r
+Received: from remotemail by yantan.tethera.net with local (Exim 4.80)\r
+ (envelope-from <bremner@tethera.net>)\r
+ id 1WRY7N-0008Oz-W3; Sat, 22 Mar 2014 23:26:33 -0300\r
+Received: (nullmailer pid 2938 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 1/2] config: add key database.upgrades\r
+Date: Sat, 22 Mar 2014 23:26:12 -0300\r
+Message-Id: <1395541573-2417-2-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
+The intent is to allow the user to enable or disable automatic\r
+database upgrades.\r
+\r
+This doesn't do anything yet.\r
+---\r
+ doc/man1/notmuch-config.rst | 4 ++++\r
+ notmuch-client.h | 7 +++++++\r
+ notmuch-config.c | 34 +++++++++++++++++++++++++++++-----\r
+ test/T030-config.sh | 1 +\r
+ test/T040-setup.sh | 1 +\r
+ 5 files changed, 42 insertions(+), 5 deletions(-)\r
+\r
+diff --git a/doc/man1/notmuch-config.rst b/doc/man1/notmuch-config.rst\r
+index 3c9a568..fc7fab6 100644\r
+--- a/doc/man1/notmuch-config.rst\r
++++ b/doc/man1/notmuch-config.rst\r
+@@ -49,6 +49,10 @@ The available configuration items are described below.\r
+ within a sub-directory of the path configured here named\r
+ ``.notmuch``.\r
+ \r
++ **database.upgrades**\r
++ Set to ``yes`` to enable automatic in-place upgrades of the notmuch\r
++ database.\r
++\r
+ **user.name**\r
+ Your full name.\r
+ \r
+diff --git a/notmuch-client.h b/notmuch-client.h\r
+index 278b498..3891a82 100644\r
+--- a/notmuch-client.h\r
++++ b/notmuch-client.h\r
+@@ -275,6 +275,13 @@ notmuch_config_set_database_path (notmuch_config_t *config,\r
+ const char *database_path);\r
+ \r
+ const char *\r
++notmuch_config_get_database_upgrades (notmuch_config_t *config);\r
++\r
++void\r
++notmuch_config_set_database_upgrades (notmuch_config_t *config,\r
++ const char *database_upgrades);\r
++\r
++const char *\r
+ notmuch_config_get_user_name (notmuch_config_t *config);\r
+ \r
+ void\r
+diff --git a/notmuch-config.c b/notmuch-config.c\r
+index 8d28653..8f4ce99 100644\r
+--- a/notmuch-config.c\r
++++ b/notmuch-config.c\r
+@@ -32,11 +32,16 @@ static const char toplevel_config_comment[] =\r
+ static const char database_config_comment[] =\r
+ " Database configuration\n"\r
+ "\n"\r
+- " The only value supported here is 'path' which should be the top-level\n"\r
+- " directory where your mail currently exists and to where mail will be\n"\r
+- " delivered in the future. Files should be individual email messages.\n"\r
+- " Notmuch will store its database within a sub-directory of the path\n"\r
+- " configured here named \".notmuch\".\n";\r
++ "The following options are supported here:\n"\r
++ "\n"\r
++ "\tpath The top-level directory where your mail currently exists\n"\r
++ "\t and to where mail will be delivered in the future. Files\n"\r
++ "\t should be individual email messages. Notmuch will store\n"\r
++ "\t its database within a sub-directory (named .notmuch) of\n"\r
++ "\t the path configured here.\n"\r
++ "\n"\r
++ "\tupgrades Set to 'yes' to enable automatic database upgrades.\n"\r
++ "\n";\r
+ \r
+ static const char new_config_comment[] =\r
+ " Configuration for \"notmuch new\"\n"\r
+@@ -107,6 +112,7 @@ struct _notmuch_config {\r
+ notmuch_bool_t is_new;\r
+ \r
+ char *database_path;\r
++ char *database_upgrades;\r
+ char *user_name;\r
+ char *user_primary_email;\r
+ const char **user_other_email;\r
+@@ -265,6 +271,7 @@ notmuch_config_open (void *ctx,\r
+ \r
+ config->is_new = FALSE;\r
+ config->database_path = NULL;\r
++ config->database_upgrades = NULL;\r
+ config->user_name = NULL;\r
+ config->user_primary_email = NULL;\r
+ config->user_other_email = NULL;\r
+@@ -328,6 +335,10 @@ notmuch_config_open (void *ctx,\r
+ talloc_free (path);\r
+ }\r
+ \r
++ if (notmuch_config_get_database_upgrades (config) == NULL) {\r
++ notmuch_config_set_database_upgrades (config, "no");\r
++ }\r
++\r
+ if (notmuch_config_get_user_name (config) == NULL) {\r
+ char *name = get_name_from_passwd_file (config);\r
+ notmuch_config_set_user_name (config, name);\r
+@@ -582,6 +593,19 @@ notmuch_config_set_database_path (notmuch_config_t *config,\r
+ }\r
+ \r
+ const char *\r
++notmuch_config_get_database_upgrades (notmuch_config_t *config)\r
++{\r
++ return _config_get (config, &config->database_upgrades, "database", "upgrades");\r
++}\r
++\r
++void\r
++notmuch_config_set_database_upgrades (notmuch_config_t *config,\r
++ const char *database_upgrades)\r
++{\r
++ _config_set (config, &config->database_upgrades, "database", "upgrades", database_upgrades);\r
++}\r
++\r
++const char *\r
+ notmuch_config_get_user_name (notmuch_config_t *config)\r
+ {\r
+ return _config_get (config, &config->user_name, "user", "name");\r
+diff --git a/test/T030-config.sh b/test/T030-config.sh\r
+index ca4cf33..d095f0e 100755\r
+--- a/test/T030-config.sh\r
++++ b/test/T030-config.sh\r
+@@ -47,6 +47,7 @@ notmuch config set database.path "/canonical/path"\r
+ output=$(notmuch config list)\r
+ test_expect_equal "$output" "\\r
+ database.path=/canonical/path\r
++database.upgrades=no\r
+ user.name=Notmuch Test Suite\r
+ user.primary_email=test_suite@notmuchmail.org\r
+ user.other_email=test_suite_other@notmuchmail.org;test_suite@otherdomain.org\r
+diff --git a/test/T040-setup.sh b/test/T040-setup.sh\r
+index 124ef1c..46fd327 100755\r
+--- a/test/T040-setup.sh\r
++++ b/test/T040-setup.sh\r
+@@ -16,6 +16,7 @@ EOF\r
+ output=$(notmuch --config=new-notmuch-config config list)\r
+ test_expect_equal "$output" "\\r
+ database.path=/path/to/maildir\r
++database.upgrades=no\r
+ user.name=Test Suite\r
+ user.primary_email=test.suite@example.com\r
+ user.other_email=another.suite@example.com;\r
+-- \r
+1.9.0\r
+\r