--- /dev/null
+Return-Path: <jani@nikula.org>\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 2342E431FDD\r
+ for <notmuch@notmuchmail.org>; Sun, 3 Nov 2013 04:25:49 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+ tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 yOCx0oTxLJva for <notmuch@notmuchmail.org>;\r
+ Sun, 3 Nov 2013 04:25:43 -0800 (PST)\r
+Received: from mail-ee0-f43.google.com (mail-ee0-f43.google.com\r
+ [74.125.83.43]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client\r
+ certificate requested) by olra.theworths.org (Postfix) with ESMTPS id\r
+ B141A431FBF for <notmuch@notmuchmail.org>; Sun, 3 Nov 2013 04:25:18 -0800\r
+ (PST)\r
+Received: by mail-ee0-f43.google.com with SMTP id b47so582454eek.16\r
+ for <notmuch@notmuchmail.org>; Sun, 03 Nov 2013 04:25:17 -0800 (PST)\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+ d=1e100.net; s=20130820;\r
+ h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\r
+ :references:in-reply-to:references;\r
+ bh=0JB2ZzawPIouY6NvmqrRui1+ge8R9xGhl9qz5SRR5hQ=;\r
+ b=XhtarUtEQutoYba80XKCCDPhPycNh8GJCOrK6yR7tC0PAAy1LED6eM6gJiwagPf1JF\r
+ AVfvywCeq5Z1gk4LB+ll3agEfx7M1LtIB3hAen5s5E6QqgAfSPrlXyPlICKdF86N7Dx0\r
+ 0/FPV6JkxeiUxJyVjOqFNnu5CI9Tg7PY7E3KJCM3nvz9oWxq6ZINDUrstY+nw/9FCIfb\r
+ UH+WYPfhlNM+ocJmiHK3nJX8LEJWHyICWY2yyixZzzhVVknzm7XQ1UAdx/AuyqhPF3NW\r
+ Gy5QMRfUupQNDtGEZP2npbeVEA9M1AIztKAur9O1B4PdOk4xdlZXCYu7buKRjNR4RuXP\r
+ CqZg==\r
+X-Gm-Message-State:\r
+ ALoCoQnzbGTHD0x06St8avDC4qfTtBRrouMzcntVeGpnHViLC8l3UFl7Y0JbX1cVCyp+6De/vIjR\r
+X-Received: by 10.14.246.11 with SMTP id p11mr12725703eer.9.1383481517576;\r
+ Sun, 03 Nov 2013 04:25:17 -0800 (PST)\r
+Received: from localhost (dsl-hkibrasgw2-58c36f-91.dhcp.inet.fi.\r
+ [88.195.111.91]) by mx.google.com with ESMTPSA id\r
+ bn13sm32810609eeb.11.2013.11.03.04.25.16 for <multiple recipients>\r
+ (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
+ Sun, 03 Nov 2013 04:25:17 -0800 (PST)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v2 09/11] cli: add compact --backup=DIRECTORY option,\r
+ don't backup by default\r
+Date: Sun, 3 Nov 2013 14:24:49 +0200\r
+Message-Id:\r
+ <c83913a215774751012213ded201a5adeee8c1dc.1383481295.git.jani@nikula.org>\r
+X-Mailer: git-send-email 1.8.4.rc3\r
+In-Reply-To: <cover.1383481295.git.jani@nikula.org>\r
+References: <cover.1383481295.git.jani@nikula.org>\r
+In-Reply-To: <cover.1383481295.git.jani@nikula.org>\r
+References: <cover.1383481295.git.jani@nikula.org>\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, 03 Nov 2013 12:25:49 -0000\r
+\r
+It's the user's decision. The recommended way is to do a database dump\r
+anyway. Clean up the relevant printfs too.\r
+\r
+---\r
+\r
+v2: reorder prints\r
+---\r
+ notmuch-compact.c | 27 +++++++++++++--------------\r
+ test/compact | 4 ++--\r
+ 2 files changed, 15 insertions(+), 16 deletions(-)\r
+\r
+diff --git a/notmuch-compact.c b/notmuch-compact.c\r
+index b9461c2..359acfc 100644\r
+--- a/notmuch-compact.c\r
++++ b/notmuch-compact.c\r
+@@ -27,16 +27,19 @@ status_update_cb (const char *msg, unused (void *closure))\r
+ }\r
+ \r
+ int\r
+-notmuch_compact_command (notmuch_config_t *config,\r
+- unused (int argc),\r
+- unused (char *argv[]))\r
++notmuch_compact_command (notmuch_config_t *config, int argc, char *argv[])\r
+ {\r
+ const char *path = notmuch_config_get_database_path (config);\r
+- const char *backup_path;\r
++ const char *backup_path = NULL;\r
+ notmuch_status_t ret;\r
++ int opt_index;\r
+ \r
+- backup_path = talloc_asprintf (config, "%s/xapian.old", path);\r
+- if (! backup_path)\r
++ notmuch_opt_desc_t options[] = {\r
++ { NOTMUCH_OPT_STRING, &backup_path, "backup", 0, 0 },\r
++ };\r
++\r
++ opt_index = parse_arguments (argc, argv, options, 1);\r
++ if (opt_index < 0)\r
+ return 1;\r
+ \r
+ printf ("Compacting database...\n");\r
+@@ -46,14 +49,10 @@ notmuch_compact_command (notmuch_config_t *config,\r
+ return 1;\r
+ }\r
+ \r
+- printf ("\n");\r
+- printf ("\n");\r
+- printf ("The old database has been moved to %s", backup_path);\r
+- printf ("\n");\r
+- printf ("To delete run,\n");\r
+- printf ("\n");\r
+- printf (" rm -R %s\n", backup_path);\r
+- printf ("\n");\r
++ if (backup_path)\r
++ printf ("The old database has been moved to %s.\n", backup_path);\r
++\r
++ printf ("Done.\n");\r
+ \r
+ return 0;\r
+ }\r
+diff --git a/test/compact b/test/compact\r
+index afab537..ac174ce 100755\r
+--- a/test/compact\r
++++ b/test/compact\r
+@@ -10,7 +10,7 @@ notmuch tag +tag1 \*\r
+ notmuch tag +tag2 subject:Two\r
+ notmuch tag -tag1 +tag3 subject:Three\r
+ \r
+-test_expect_success "Running compact" "notmuch compact"\r
++test_expect_success "Running compact" "notmuch compact --backup=${TEST_DIRECTORY}/xapian.old"\r
+ \r
+ test_begin_subtest "Compact preserves database"\r
+ output=$(notmuch search \* | notmuch_search_sanitize)\r
+@@ -21,7 +21,7 @@ thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; Three (inbox tag3 unread)"\r
+ \r
+ test_expect_success 'Restoring Backup' \\r
+ 'rm -Rf ${MAIL_DIR}/.notmuch/xapian &&\r
+- mv ${MAIL_DIR}/xapian.old ${MAIL_DIR}/.notmuch/xapian'\r
++ mv ${TEST_DIRECTORY}/xapian.old ${MAIL_DIR}/.notmuch/xapian'\r
+ \r
+ test_begin_subtest "Checking restored backup"\r
+ output=$(notmuch search \* | notmuch_search_sanitize)\r
+-- \r
+1.8.4.rc3\r
+\r