1 Return-Path: <jani@nikula.org>
\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 816D2431FD6
\r
6 for <notmuch@notmuchmail.org>; Sun, 23 Feb 2014 14:22:24 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\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 3wycUm3baTpm for <notmuch@notmuchmail.org>;
\r
16 Sun, 23 Feb 2014 14:22:15 -0800 (PST)
\r
17 Received: from mail-ee0-f51.google.com (mail-ee0-f51.google.com
\r
18 [74.125.83.51]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client
\r
19 certificate requested) by olra.theworths.org (Postfix) with ESMTPS id
\r
20 2196E431FCF for <notmuch@notmuchmail.org>; Sun, 23 Feb 2014 14:22:15 -0800
\r
22 Received: by mail-ee0-f51.google.com with SMTP id b57so2772311eek.24
\r
23 for <notmuch@notmuchmail.org>; Sun, 23 Feb 2014 14:22:12 -0800 (PST)
\r
24 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
\r
25 d=1e100.net; s=20130820;
\r
26 h=x-gm-message-state:from:to:cc:subject:in-reply-to:references
\r
27 :user-agent:date:message-id:mime-version:content-type;
\r
28 bh=bOHTjL7f0i3cgmPvbIjdEDHqj6hW7DLI9abvLBhb0os=;
\r
29 b=h702OTZN6zGQ/o0ntFKjPdr8KDeFOY1K3PpABWW6l7gest/6MTk3cfOy8bIqeDpK7H
\r
30 P/STHExxG9vQ4ammz6P1R0qKVRKSzcfChrCo8k06lj6FfxFF/N0FvSLhi4zeM//CV+mZ
\r
31 aApT6Rvktm4eyzK7Fur7ESY0cqfl1JxYBMSUn5WZjeDj/dyvvuuedGEmoNbkPHvUwbeL
\r
32 4zyzoEr3j5fPDnUewQbI3wdH7Vusu2ySGn8fQn/l6S26RhIPPbjCN2Vjij0kb4P3lFn4
\r
33 o6rpIs09dBAsJ3+AYQcJJE53mmV1CBgyU/nPBNr/8anVLN5IqySajy1c+P5f9IgKwsh7
\r
36 ALoCoQmf+YlgnuVpSV81WyilYP/jaDsNAHwst/bRkrZ8TIQ3z/T8Kl8S5Z+l7H7eBxKDNWWo3bJX
\r
37 X-Received: by 10.14.221.201 with SMTP id r49mr21126016eep.104.1393194132605;
\r
38 Sun, 23 Feb 2014 14:22:12 -0800 (PST)
\r
39 Received: from localhost (dsl-hkibrasgw2-58c36f-91.dhcp.inet.fi.
\r
41 by mx.google.com with ESMTPSA id q44sm56081208eez.1.2014.02.23.14.22.11
\r
42 for <multiple recipients>
\r
43 (version=TLSv1.2 cipher=RC4-SHA bits=128/128);
\r
44 Sun, 23 Feb 2014 14:22:11 -0800 (PST)
\r
45 From: Jani Nikula <jani@nikula.org>
\r
46 To: Tomi Ollila <tomi.ollila@iki.fi>, notmuch@notmuchmail.org
\r
47 Subject: Re: [DRAFT PATCH] notmuch new: do not ignore '.notmuch' in
\r
48 non-toplevel directories
\r
49 In-Reply-To: <1393183127-31869-1-git-send-email-tomi.ollila@iki.fi>
\r
50 References: <87mwhifu9a.fsf@trouble.defaultvalue.org>
\r
51 <1393183127-31869-1-git-send-email-tomi.ollila@iki.fi>
\r
52 User-Agent: Notmuch/0.17+44~ge3b4cd9 (http://notmuchmail.org) Emacs/24.3.1
\r
53 (x86_64-pc-linux-gnu)
\r
54 Date: Mon, 24 Feb 2014 00:22:10 +0200
\r
55 Message-ID: <87ios5v59p.fsf@nikula.org>
\r
57 Content-Type: text/plain
\r
58 Cc: tomi.ollila@iki.fi
\r
59 X-BeenThere: notmuch@notmuchmail.org
\r
60 X-Mailman-Version: 2.1.13
\r
62 List-Id: "Use and development of the notmuch mail system."
\r
63 <notmuch.notmuchmail.org>
\r
64 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
65 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
66 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
67 List-Post: <mailto:notmuch@notmuchmail.org>
\r
68 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
69 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
70 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
71 X-List-Received-Date: Sun, 23 Feb 2014 22:22:24 -0000
\r
73 On Sun, 23 Feb 2014, Tomi Ollila <tomi.ollila@iki.fi> wrote:
\r
74 > So that users may have email in subdir/.notmuch directories.
\r
77 > Compiles, current tests pass. might ignore database_path/.notmuch and
\r
78 > might descent into database_path/.../.notmuch :D
\r
83 > notmuch-new.c | 18 ++++++++++--------
\r
84 > 1 file changed, 10 insertions(+), 8 deletions(-)
\r
86 > diff --git a/notmuch-new.c b/notmuch-new.c
\r
87 > index 8529fdd..b17bd75 100644
\r
88 > --- a/notmuch-new.c
\r
89 > +++ b/notmuch-new.c
\r
90 > @@ -344,7 +344,8 @@ add_file (notmuch_database_t *notmuch, const char *filename,
\r
91 > static notmuch_status_t
\r
92 > add_files (notmuch_database_t *notmuch,
\r
94 > - add_files_state_t *state)
\r
95 > + add_files_state_t *state,
\r
98 I think this is ugly and makes the interface harder to use for indexing
\r
103 diff --git a/notmuch-new.c b/notmuch-new.c
\r
104 index 8529fdd3eac7..20bc33fca4bd 100644
\r
105 --- a/notmuch-new.c
\r
106 +++ b/notmuch-new.c
\r
107 @@ -469,7 +469,8 @@ add_files (notmuch_database_t *notmuch,
\r
108 if (strcmp (entry->d_name, ".") == 0 ||
\r
109 strcmp (entry->d_name, "..") == 0 ||
\r
110 (is_maildir && strcmp (entry->d_name, "tmp") == 0) ||
\r
111 - strcmp (entry->d_name, ".notmuch") == 0)
\r
112 + (strcmp (entry->d_name, ".notmuch") == 0 &&
\r
113 + strcmp (path, notmuch_database_get_path (notmuch)) == 0))
\r
116 next = talloc_asprintf (notmuch, "%s/%s", path, entry->d_name);
\r
118 And similarly in count_files(), with the root db path passed as first
\r
119 argument (as the db is not open yet).
\r
129 > struct dirent *entry = NULL;
\r
130 > @@ -469,11 +470,11 @@ add_files (notmuch_database_t *notmuch,
\r
131 > if (strcmp (entry->d_name, ".") == 0 ||
\r
132 > strcmp (entry->d_name, "..") == 0 ||
\r
133 > (is_maildir && strcmp (entry->d_name, "tmp") == 0) ||
\r
134 > - strcmp (entry->d_name, ".notmuch") == 0)
\r
135 > + (dirlevel == 0 && strcmp (entry->d_name, ".notmuch") == 0))
\r
138 > next = talloc_asprintf (notmuch, "%s/%s", path, entry->d_name);
\r
139 > - status = add_files (notmuch, next, state);
\r
140 > + status = add_files (notmuch, next, state, dirlevel + 1);
\r
144 > @@ -702,7 +703,8 @@ stop_progress_printing_timer (void)
\r
145 > * initialized to zero by the top-level caller before calling
\r
146 > * count_files). */
\r
148 > -count_files (const char *path, int *count, add_files_state_t *state)
\r
149 > +count_files (const char *path, int *count, add_files_state_t *state,
\r
152 > struct dirent *entry = NULL;
\r
154 > @@ -725,7 +727,7 @@ count_files (const char *path, int *count, add_files_state_t *state)
\r
156 > if (strcmp (entry->d_name, ".") == 0 ||
\r
157 > strcmp (entry->d_name, "..") == 0 ||
\r
158 > - strcmp (entry->d_name, ".notmuch") == 0 ||
\r
159 > + (dirlevel == 0 && strcmp (entry->d_name, ".notmuch") == 0) ||
\r
160 > _entry_in_ignore_list (entry->d_name, state))
\r
162 > if (state->debug && _entry_in_ignore_list (entry->d_name, state))
\r
163 > @@ -750,7 +752,7 @@ count_files (const char *path, int *count, add_files_state_t *state)
\r
166 > } else if (entry_type == S_IFDIR) {
\r
167 > - count_files (next, count, state);
\r
168 > + count_files (next, count, state, dirlevel + 1);
\r
172 > @@ -962,7 +964,7 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[])
\r
176 > - count_files (db_path, &count, &add_files_state);
\r
177 > + count_files (db_path, &count, &add_files_state, 0);
\r
179 > return EXIT_FAILURE;
\r
181 > @@ -1021,7 +1023,7 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[])
\r
182 > timer_is_active = TRUE;
\r
185 > - ret = add_files (notmuch, db_path, &add_files_state);
\r
186 > + ret = add_files (notmuch, db_path, &add_files_state, 0);
\r
193 > _______________________________________________
\r
194 > notmuch mailing list
\r
195 > notmuch@notmuchmail.org
\r
196 > http://notmuchmail.org/mailman/listinfo/notmuch
\r