1 Return-Path: <markwalters1009@gmail.com>
\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 741E0431FAF
\r
6 for <notmuch@notmuchmail.org>; Thu, 6 Mar 2014 12:58:45 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0.201 tagged_above=-999 required=5
\r
12 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
\r
13 FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,
\r
14 RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\r
15 Received: from olra.theworths.org ([127.0.0.1])
\r
16 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
17 with ESMTP id ofvF25MBpADm for <notmuch@notmuchmail.org>;
\r
18 Thu, 6 Mar 2014 12:58:39 -0800 (PST)
\r
19 Received: from mail-wg0-f46.google.com (mail-wg0-f46.google.com
\r
20 [74.125.82.46]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client
\r
21 certificate requested) by olra.theworths.org (Postfix) with ESMTPS id
\r
22 53EDE431FAE for <notmuch@notmuchmail.org>; Thu, 6 Mar 2014 12:58:39 -0800
\r
24 Received: by mail-wg0-f46.google.com with SMTP id z12so3917701wgg.5
\r
25 for <notmuch@notmuchmail.org>; Thu, 06 Mar 2014 12:58:36 -0800 (PST)
\r
26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
\r
27 h=from:to:cc:subject:date:message-id;
\r
28 bh=2gvtUeMD6hLOWIgRiBnbjBv7NRaXCD1KXqCV/oEwoAo=;
\r
29 b=XmX3v5g5g5FU1Frkw0VuSscgsH40u4RuOXnGP8Yor1OvWd25myUu7jrPCDNDbChm4W
\r
30 r39JeJB+JOPyh/8PM9SQQzeZWuWiNnbC2Nbtk8fjPg8XAZ1x2LD6VBj3FLnnLu1m87ww
\r
31 qRH0ym9AjJLhUQ02oVhTYnRSV5HPD0psRR/morz3JABIazRwjvgXxiCEoGT1yAQj5QGu
\r
32 oa3Rjzlca+nwq4LhCq0+BhmTQRUKTQRehTtYNctkbLwss3tPJg4IvRlHKF5MUBJ7DpOG
\r
33 475cA4Sj4pi7MqyB8lmYFqJ0IPe7Bf3+OBlaolGw+qAwW7fAOEy8F5q/EfVzWrSqA8+p
\r
35 X-Received: by 10.194.143.82 with SMTP id sc18mr13582706wjb.11.1394139515294;
\r
36 Thu, 06 Mar 2014 12:58:35 -0800 (PST)
\r
37 Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31])
\r
38 by mx.google.com with ESMTPSA id z1sm22809906wjq.19.2014.03.06.12.58.34
\r
39 for <multiple recipients>
\r
40 (version=TLSv1.2 cipher=RC4-SHA bits=128/128);
\r
41 Thu, 06 Mar 2014 12:58:34 -0800 (PST)
\r
42 From: Mark Walters <markwalters1009@gmail.com>
\r
43 To: notmuch@notmuchmail.org
\r
44 Subject: [PATCH] notmuch new: add a --in-directory option
\r
45 Date: Thu, 6 Mar 2014 20:58:27 +0000
\r
46 Message-Id: <1394139507-15324-1-git-send-email-markwalters1009@gmail.com>
\r
47 X-Mailer: git-send-email 1.7.9.1
\r
48 X-BeenThere: notmuch@notmuchmail.org
\r
49 X-Mailman-Version: 2.1.13
\r
51 List-Id: "Use and development of the notmuch mail system."
\r
52 <notmuch.notmuchmail.org>
\r
53 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
54 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
55 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
56 List-Post: <mailto:notmuch@notmuchmail.org>
\r
57 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
58 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
59 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
60 X-List-Received-Date: Thu, 06 Mar 2014 20:58:45 -0000
\r
62 This patch adds a --in-directory=folder option to notmuch new which
\r
63 tells it to only check for new messages inside folder (relative to the
\r
67 NOTE This is only very lightly tested (but seems to work) so please
\r
68 make sure you backup the notmuch database before testing!
\r
71 notmuch-new.c | 10 +++++++++-
\r
72 test/T050-new.sh | 15 +++++++++++++++
\r
73 2 files changed, 24 insertions(+), 1 deletions(-)
\r
75 diff --git a/notmuch-new.c b/notmuch-new.c
\r
76 index 8529fdd..d3526ac 100644
\r
79 @@ -922,6 +922,8 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[])
\r
80 notmuch_bool_t timer_is_active = FALSE;
\r
81 notmuch_bool_t no_hooks = FALSE;
\r
82 notmuch_bool_t quiet = FALSE, verbose = FALSE;
\r
83 + char *directory = NULL;
\r
84 + char *path = NULL;
\r
86 add_files_state.verbosity = VERBOSITY_NORMAL;
\r
87 add_files_state.debug = FALSE;
\r
88 @@ -932,6 +934,7 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[])
\r
89 { NOTMUCH_OPT_BOOLEAN, &verbose, "verbose", 'v', 0 },
\r
90 { NOTMUCH_OPT_BOOLEAN, &add_files_state.debug, "debug", 'd', 0 },
\r
91 { NOTMUCH_OPT_BOOLEAN, &no_hooks, "no-hooks", 'n', 0 },
\r
92 + { NOTMUCH_OPT_STRING, &directory, "in-directory", 'i', 0 },
\r
96 @@ -1021,7 +1024,12 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[])
\r
97 timer_is_active = TRUE;
\r
100 - ret = add_files (notmuch, db_path, &add_files_state);
\r
102 + path = talloc_asprintf (config, "%s/%s", db_path, directory);
\r
104 + path = talloc_strdup (config, db_path);
\r
106 + ret = add_files (notmuch, path, &add_files_state);
\r
110 diff --git a/test/T050-new.sh b/test/T050-new.sh
\r
111 index b7668ff..b8e68a3 100755
\r
112 --- a/test/T050-new.sh
\r
113 +++ b/test/T050-new.sh
\r
114 @@ -263,4 +263,19 @@ notmuch search --format=text0 --output=files --offset=1 --limit=1 '*' | xargs -0
\r
115 output=$(NOTMUCH_NEW --quiet)
\r
116 test_expect_equal "$output" ""
\r
118 +test_begin_subtest "In-directory"
\r
119 +rm -rf "${MAIL_DIR}"/* "${MAIL_DIR}"/.notmuch
\r
120 +mkdir "${MAIL_DIR}"/def
\r
121 +mkdir "${MAIL_DIR}"/ghi
\r
122 +generate_message [dir]=def
\r
123 +generate_message [dir]=ghi
\r
126 +output=$(NOTMUCH_NEW --in-directory=def)
\r
127 +test_expect_equal "$output" "Added 1 new message to the database."
\r
129 +test_begin_subtest "New after --in-directory"
\r
130 +output=$(NOTMUCH_NEW)
\r
131 +test_expect_equal "$output" "Added 2 new messages to the database."
\r