From: David Bremner <david@tethera.net>
To: Jani Nikula <jani@nikula.org>, David Bremner <david@tethera.net>,
notmuch@notmuchmail.org
Subject: [PATCH 1/4] CLI/new: add full-scan option
Date: Sun, 29 Apr 2018 20:19:40 -0300 [thread overview]
Message-ID: <20180429231943.21780-1-david@tethera.net> (raw)
In-Reply-To: <874lju7zmv.fsf@nikula.org>
By default notmuch-new uses directory mtimes to optimize the scanning of
directories for new mail. This option allows turning that optimization
off e.g. for testing or debugging.
---
notmuch-new.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/notmuch-new.c b/notmuch-new.c
index c4345705..6a54a1a1 100644
--- a/notmuch-new.c
+++ b/notmuch-new.c
@@ -47,6 +47,7 @@ typedef struct {
int output_is_a_tty;
enum verbosity verbosity;
bool debug;
+ bool full_scan;
const char **new_tags;
size_t new_tags_length;
const char **ignore_verbatim;
@@ -527,7 +528,7 @@ add_files (notmuch_database_t *notmuch,
* mistakenly return the total number of directory entries, since
* that only inflates the count beyond 2.
*/
- if (directory && fs_mtime == db_mtime && st.st_nlink == 2) {
+ if (directory && (! state->full_scan) && fs_mtime == db_mtime && st.st_nlink == 2) {
/* There's one catch: pass 1 below considers symlinks to
* directories to be directories, but these don't increase the
* file system link count. So, only bail early if the
@@ -618,7 +619,7 @@ add_files (notmuch_database_t *notmuch,
* being discovered until the clock catches up and the directory
* is modified again).
*/
- if (directory && fs_mtime == db_mtime)
+ if (directory && (! state->full_scan) && fs_mtime == db_mtime)
goto DONE;
/* If the database has never seen this directory before, we can
@@ -1053,6 +1054,7 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[])
add_files_state_t add_files_state = {
.verbosity = VERBOSITY_NORMAL,
.debug = false,
+ .full_scan = false,
.output_is_a_tty = isatty (fileno (stdout)),
};
struct timeval tv_start;
@@ -1073,6 +1075,7 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[])
{ .opt_bool = &quiet, .name = "quiet" },
{ .opt_bool = &verbose, .name = "verbose" },
{ .opt_bool = &add_files_state.debug, .name = "debug" },
+ { .opt_bool = &add_files_state.full_scan, .name = "full-scan" },
{ .opt_bool = &hooks, .name = "hooks" },
{ .opt_inherit = notmuch_shared_indexing_options },
{ .opt_inherit = notmuch_shared_options },
--
2.17.0
next prev parent reply other threads:[~2018-04-29 23:19 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-29 2:10 non-deterministic behaviour of new.ignore (regexp) test David Bremner
2018-04-29 9:02 ` Jani Nikula
2018-04-29 11:48 ` [PATCH 1/2] CLI/new: add mtime-opt option David Bremner
2018-04-29 11:48 ` [PATCH 2/2] test: use --no-mtime-opt in T050-new.sh David Bremner
2018-04-29 16:24 ` Jani Nikula
2018-04-29 16:20 ` [PATCH 1/2] CLI/new: add mtime-opt option Jani Nikula
2018-04-29 23:19 ` David Bremner [this message]
2018-04-29 23:19 ` [PATCH 2/4] test: add tests for notmuch new --full-scan David Bremner
2018-04-29 23:19 ` [PATCH 3/4] test: use --full-scan in T050-new.sh David Bremner
2018-04-29 23:19 ` [PATCH 4/4] doc: document notmuch new --full-scan David Bremner
2018-05-01 19:58 ` Tomi Ollila
2018-05-22 16:46 ` David Bremner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180429231943.21780-1-david@tethera.net \
--to=david@tethera.net \
--cc=jani@nikula.org \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).